Skip to content

Commit f62e65e

Browse files
committed
tapgarden: remove batch key argument from fundGenesisPsbt
The batch key was only used for logging. This commit moves the log messages outside fundGenesisPsbt, simplifying the function for better code health.
1 parent d5ac7d0 commit f62e65e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tapgarden/planter.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -937,12 +937,10 @@ type WalletFundPsbt = func(ctx context.Context,
937937
// (all outputs need to hold some BTC to not be dust), and with a dummy script.
938938
// We need to use a dummy script as we can't know the actual script key since
939939
// that's dependent on the genesis outpoint.
940-
func fundGenesisPsbt(ctx context.Context,
941-
pendingBatch *MintingBatch, batchKey asset.SerializedKey,
940+
func fundGenesisPsbt(ctx context.Context, pendingBatch *MintingBatch,
942941
walletFundPsbt WalletFundPsbt) (FundedMintAnchorPsbt, error) {
943942

944943
var zero FundedMintAnchorPsbt
945-
log.Infof("Attempting to fund batch: %x", batchKey)
946944

947945
// If universe commitments are enabled, we formulate a pre-commitment
948946
// output. This output is spent by the universe commitment transaction.
@@ -994,7 +992,6 @@ func fundGenesisPsbt(ctx context.Context,
994992
"funded anchor transaction")
995993
}
996994

997-
log.Infof("Funded GenesisPacket for batch: %x", batchKey)
998995
log.Tracef("GenesisPacket: %v", spew.Sdump(fundedGenesisPkt))
999996

1000997
// Classify anchor transaction output indexes.
@@ -2044,14 +2041,16 @@ func (c *ChainPlanter) fundBatch(ctx context.Context, params FundParams,
20442041
return *fundedPkt, nil
20452042
}
20462043

2044+
log.Infof("Attempting to fund batch: %x", batchKey)
20472045
mintAnchorTx, err := fundGenesisPsbt(
2048-
ctx, c.pendingBatch, batchKey, walletFundPsbt,
2046+
ctx, c.pendingBatch, walletFundPsbt,
20492047
)
20502048
if err != nil {
20512049
return fmt.Errorf("unable to fund minting PSBT for "+
20522050
"batch: %x %w", batchKey[:], err)
20532051
}
20542052

2053+
log.Infof("Funded GenesisPacket for batch: %x", batchKey)
20552054
batch.GenesisPacket = &mintAnchorTx
20562055

20572056
return nil

0 commit comments

Comments
 (0)