Skip to content

Commit d2e6d74

Browse files
committed
tapdb: set the outpoint of a pre commitment during insertion
1 parent b33b4e0 commit d2e6d74

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tapdb/asset_minting.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,12 +439,22 @@ func insertMintAnchorTx(ctx context.Context, q PendingAssetStore,
439439
},
440440
)
441441

442+
outPoint := wire.OutPoint{
443+
Hash: anchorPackage.Pkt.UnsignedTx.TxHash(),
444+
Index: uint32(preCommitOut.OutIdx),
445+
}
446+
outPointBytes, err := encodeOutpoint(outPoint)
447+
if err != nil {
448+
return fmt.Errorf("unable to encode outpoint: %w", err)
449+
}
450+
442451
_, err = q.UpsertMintAnchorUniCommitment(
443452
ctx, MintAnchorUniCommitParams{
444453
BatchKey: rawBatchKey,
445454
TxOutputIndex: int32(preCommitOut.OutIdx),
446455
TaprootInternalKeyID: internalKeyID,
447456
GroupKey: groupPubKey,
457+
Outpoint: outPointBytes,
448458
},
449459
)
450460
if err != nil {
@@ -1625,12 +1635,22 @@ func upsertPreCommit(ctx context.Context, q PendingAssetStore,
16251635
},
16261636
)
16271637

1638+
outPoint := wire.OutPoint{
1639+
Hash: genesisPkt.Pkt.UnsignedTx.TxHash(),
1640+
Index: preCommit.OutIdx,
1641+
}
1642+
outPointBytes, err := encodeOutpoint(outPoint)
1643+
if err != nil {
1644+
return fmt.Errorf("unable to encode outpoint: %w", err)
1645+
}
1646+
16281647
_, err = q.UpsertMintAnchorUniCommitment(
16291648
ctx, MintAnchorUniCommitParams{
16301649
BatchKey: batchKey,
16311650
TxOutputIndex: int32(preCommit.OutIdx),
16321651
TaprootInternalKeyID: internalKeyID,
16331652
GroupKey: groupPubKeyBytes,
1653+
Outpoint: outPointBytes,
16341654
},
16351655
)
16361656
if err != nil {

0 commit comments

Comments
 (0)