Skip to content

Commit 78c41b4

Browse files
committed
zombierecovery-makeoffer: fix witness data for psbt package.
We need to make sure we populate all the necessary witness/nonwitness because for taproot inputs we need the prevout so we check for it in the hashcash creation.
1 parent a0e5f06 commit 78c41b4

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

cmd/chantools/zombierecovery_makeoffer.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,10 +369,8 @@ func (c *zombieRecoveryMakeOfferCommand) Execute(_ *cobra.Command,
369369
return fmt.Errorf("error creating PSBT from TX: %w", err)
370370
}
371371

372-
signer := &lnd.Signer{
373-
ExtendedKey: extendedKey,
374-
ChainParams: chainParams,
375-
}
372+
// First we add the necessary information to the psbt package so that
373+
// we can sign the transaction with SIGHASH_ALL.
376374
for idx, txIn := range inputs {
377375
channel := keys1.Channels[idx]
378376

@@ -399,6 +397,16 @@ func (c *zombieRecoveryMakeOfferCommand) Execute(_ *cobra.Command,
399397
Value: channel.theirKey.SerializeCompressed(),
400398
},
401399
)
400+
}
401+
402+
// Loop a second time through the inputs and sign each input. We now
403+
// have all the witness/nonwitness data filled in the psbt package.
404+
signer := &lnd.Signer{
405+
ExtendedKey: extendedKey,
406+
ChainParams: chainParams,
407+
}
408+
for idx, txIn := range inputs {
409+
channel := keys1.Channels[idx]
402410

403411
keyDesc := keychain.KeyDescriptor{
404412
PubKey: channel.ourKey,

0 commit comments

Comments
 (0)