mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-18 04:42:41 +02:00
input: use explicit CSV 1 script for to remote output
We undo the prior hack here to make the final script more readable. The difference is just 1 byte between the two.
This commit is contained in:
parent
0c74f894c4
commit
6ce7f5d29e
@ -2231,7 +2231,9 @@ func NewRemoteCommitScriptTree(remoteKey *btcec.PublicKey,
|
|||||||
builder := txscript.NewScriptBuilder()
|
builder := txscript.NewScriptBuilder()
|
||||||
builder.AddData(schnorr.SerializePubKey(remoteKey))
|
builder.AddData(schnorr.SerializePubKey(remoteKey))
|
||||||
builder.AddOp(txscript.OP_CHECKSIG)
|
builder.AddOp(txscript.OP_CHECKSIG)
|
||||||
|
builder.AddOp(txscript.OP_1)
|
||||||
builder.AddOp(txscript.OP_CHECKSEQUENCEVERIFY)
|
builder.AddOp(txscript.OP_CHECKSEQUENCEVERIFY)
|
||||||
|
builder.AddOp(txscript.OP_DROP)
|
||||||
|
|
||||||
remoteScript, err := builder.Script()
|
remoteScript, err := builder.Script()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -2269,12 +2271,7 @@ func NewRemoteCommitScriptTree(remoteKey *btcec.PublicKey,
|
|||||||
// Our single tapleaf will use the following script:
|
// Our single tapleaf will use the following script:
|
||||||
//
|
//
|
||||||
// <remotepubkey> OP_CHECKSIG
|
// <remotepubkey> OP_CHECKSIG
|
||||||
// OP_CHECKSEQUENCEVERIFY
|
// 1 OP_CHECKSEQUENCEVERIFY OP_DROP
|
||||||
//
|
|
||||||
// The CSV clause is a bit subtle, but OP_CHECKSIG will return true if it
|
|
||||||
// succeeds, which then enforces our 1 CSV. The true will remain on the stack,
|
|
||||||
// causing the script to pass. If the CHECKSIG fails, then a 0 will remain on
|
|
||||||
// the stack.
|
|
||||||
func TaprootCommitScriptToRemote(remoteKey *btcec.PublicKey,
|
func TaprootCommitScriptToRemote(remoteKey *btcec.PublicKey,
|
||||||
) (*btcec.PublicKey, error) {
|
) (*btcec.PublicKey, error) {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user