Skip to content

Commit

Permalink
replace 80 with btcd defined constant; update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ws4charlie committed Nov 1, 2024
1 parent 9f958cf commit abb90d3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions e2e/runner/bitcoin_inscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func NewTapscriptSpender(net *chaincfg.Params) *TapscriptSpender {
// GenerateCommitAddress generates a Taproot commit address for the given receiver and payload
func (s *TapscriptSpender) GenerateCommitAddress(memo []byte) (*btcutil.AddressTaproot, error) {
// OP_RETURN is a better choice for memo <= 80 bytes
if len(memo) <= 80 {
if len(memo) <= txscript.MaxDataCarrierSize {
return nil, fmt.Errorf("OP_RETURN is a better choice for memo <= 80 bytes")
}

Expand Down Expand Up @@ -84,7 +84,7 @@ func (s *TapscriptSpender) BuildRevealTxn(
}
revealTx.AddTxOut(wire.NewTxOut(commitAmount-fee, pkScript))

// Step 5: compute the sighash for the P2TR input to be spent using script path
// Step 4: compute the sighash for the P2TR input to be spent using script path
commitScript, err := txscript.PayToAddrScript(s.taprootOutputAddr)
if err != nil {
return nil, errors.Wrap(err, "failed to create commit pkScript")
Expand All @@ -103,7 +103,7 @@ func (s *TapscriptSpender) BuildRevealTxn(
return nil, errors.Wrap(err, "failed to calculate tapscript sighash")
}

// Step 6: sign the sighash with the internal key
// Step 5: sign the sighash with the internal key
sig, err := schnorr.Sign(s.internalKey, sigHash)
if err != nil {
return nil, errors.Wrap(err, "failed to sign sighash")
Expand Down

0 comments on commit abb90d3

Please sign in to comment.