fix: send tx

This commit is contained in:
Anh Minh 2025-10-09 11:06:46 +07:00
parent 61e84ab801
commit 1f2db5b7e3
3 changed files with 5 additions and 9 deletions

View File

@ -146,11 +146,7 @@ func HashSource(source *nockchain.NockchainSource) [5]uint64 {
return crypto.Tip5Zero return crypto.Tip5Zero
} }
sourceHash := crypto.Base58ToTip5Hash(source.Source) sourceHash := crypto.Base58ToTip5Hash(source.Source)
if source.IsCoinbase {
return crypto.Tip5RehashTenCell(sourceHash, crypto.Tip5One) return crypto.Tip5RehashTenCell(sourceHash, crypto.Tip5One)
} else {
return crypto.Tip5RehashTenCell(sourceHash, crypto.Tip5Zero)
}
} }
func HashSeedWithoutSource(seed *nockchain.NockchainSeed) ([5]uint64, error) { func HashSeedWithoutSource(seed *nockchain.NockchainSeed) ([5]uint64, error) {

View File

@ -472,7 +472,7 @@ func (h *GprcHandler) CreateTx(ctx context.Context, req *nockchain.CreateTxReque
TxId: "", TxId: "",
Inputs: inputs, Inputs: inputs,
TimelockRange: timelockRange, TimelockRange: timelockRange,
TotalFees: req.Fee, TotalFees: req.Fee * uint64(len(inputs)),
} }
txId, err := ComputeTxId(inputs, timelockRange, req.Fee) txId, err := ComputeTxId(inputs, timelockRange, req.Fee)
if err != nil { if err != nil {

View File

@ -67,7 +67,7 @@ func ParseBalanceEntry(entry *nockchain.BalanceEntry) nockchain.NockchainNote {
}, },
Source: &nockchain.NockchainSource{ Source: &nockchain.NockchainSource{
Source: crypto.Tip5HashToBase58(sourceHash), Source: crypto.Tip5HashToBase58(sourceHash),
IsCoinbase: true, IsCoinbase: entry.Note.Source.Coinbase,
}, },
Asset: entry.Note.Assets.Value, Asset: entry.Note.Assets.Value,
} }
@ -113,12 +113,12 @@ func ConvertInput(input *nockchain.NockchainInput) (*nockchain.NamedInput, error
for _, seed := range input.Spend.Seeds { for _, seed := range input.Spend.Seeds {
seedPks := []*nockchain.SchnorrPubkey{} seedPks := []*nockchain.SchnorrPubkey{}
for _, i := range input.Note.Lock.Pubkeys { for _, i := range seed.Recipient.Pubkeys {
pk, err := ParseSchnorrPubkey(i) pk, err := ParseSchnorrPubkey(i)
if err != nil { if err != nil {
return nil, err return nil, err
} }
pks = append(seedPks, pk) seedPks = append(seedPks, pk)
} }
var source *nockchain.OutputSource var source *nockchain.OutputSource
if seed.OutputSource != nil { if seed.OutputSource != nil {