mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
sweep: allow sweeper to sweep P2TR inputs
This commit is contained in:
parent
36d6656d0d
commit
a3e4db60cd
@ -355,17 +355,6 @@ func (t *txInputSet) tryAddWalletInputsIfNeeded() error {
|
||||
// createWalletTxInput converts a wallet utxo into an object that can be added
|
||||
// to the other inputs to sweep.
|
||||
func createWalletTxInput(utxo *lnwallet.Utxo) (input.Input, error) {
|
||||
var witnessType input.WitnessType
|
||||
switch utxo.AddressType {
|
||||
case lnwallet.WitnessPubKey:
|
||||
witnessType = input.WitnessKeyHash
|
||||
case lnwallet.NestedWitnessPubKey:
|
||||
witnessType = input.NestedWitnessKeyHash
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown address type %v",
|
||||
utxo.AddressType)
|
||||
}
|
||||
|
||||
signDesc := &input.SignDescriptor{
|
||||
Output: &wire.TxOut{
|
||||
PkScript: utxo.PkScript,
|
||||
@ -374,6 +363,20 @@ func createWalletTxInput(utxo *lnwallet.Utxo) (input.Input, error) {
|
||||
HashType: txscript.SigHashAll,
|
||||
}
|
||||
|
||||
var witnessType input.WitnessType
|
||||
switch utxo.AddressType {
|
||||
case lnwallet.WitnessPubKey:
|
||||
witnessType = input.WitnessKeyHash
|
||||
case lnwallet.NestedWitnessPubKey:
|
||||
witnessType = input.NestedWitnessKeyHash
|
||||
case lnwallet.TaprootPubkey:
|
||||
witnessType = input.TaprootPubKeySpend
|
||||
signDesc.HashType = txscript.SigHashDefault
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown address type %v",
|
||||
utxo.AddressType)
|
||||
}
|
||||
|
||||
// A height hint doesn't need to be set, because we don't monitor these
|
||||
// inputs for spend.
|
||||
heightHint := uint32(0)
|
||||
|
Loading…
Reference in New Issue
Block a user