Skip to content

Commit a3e4db6

Browse files
committed
sweep: allow sweeper to sweep P2TR inputs
1 parent 36d6656 commit a3e4db6

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

sweep/tx_input_set.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -355,25 +355,28 @@ func (t *txInputSet) tryAddWalletInputsIfNeeded() error {
355355
// createWalletTxInput converts a wallet utxo into an object that can be added
356356
// to the other inputs to sweep.
357357
func createWalletTxInput(utxo *lnwallet.Utxo) (input.Input, error) {
358+
signDesc := &input.SignDescriptor{
359+
Output: &wire.TxOut{
360+
PkScript: utxo.PkScript,
361+
Value: int64(utxo.Value),
362+
},
363+
HashType: txscript.SigHashAll,
364+
}
365+
358366
var witnessType input.WitnessType
359367
switch utxo.AddressType {
360368
case lnwallet.WitnessPubKey:
361369
witnessType = input.WitnessKeyHash
362370
case lnwallet.NestedWitnessPubKey:
363371
witnessType = input.NestedWitnessKeyHash
372+
case lnwallet.TaprootPubkey:
373+
witnessType = input.TaprootPubKeySpend
374+
signDesc.HashType = txscript.SigHashDefault
364375
default:
365376
return nil, fmt.Errorf("unknown address type %v",
366377
utxo.AddressType)
367378
}
368379

369-
signDesc := &input.SignDescriptor{
370-
Output: &wire.TxOut{
371-
PkScript: utxo.PkScript,
372-
Value: int64(utxo.Value),
373-
},
374-
HashType: txscript.SigHashAll,
375-
}
376-
377380
// A height hint doesn't need to be set, because we don't monitor these
378381
// inputs for spend.
379382
heightHint := uint32(0)

0 commit comments

Comments
 (0)