mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-05 17:05:50 +02:00
multi: add p2tr keyspend wallet support
This commit is contained in:
@@ -461,6 +461,8 @@ func (b *BtcWallet) keyScopeForAccountAddr(accountName string,
|
||||
addrKeyScope = waddrmgr.KeyScopeBIP0084
|
||||
case lnwallet.NestedWitnessPubKey:
|
||||
addrKeyScope = waddrmgr.KeyScopeBIP0049Plus
|
||||
case lnwallet.TaprootPubkey:
|
||||
addrKeyScope = waddrmgr.KeyScopeBIP0086
|
||||
default:
|
||||
return waddrmgr.KeyScope{}, 0,
|
||||
fmt.Errorf("unknown address type")
|
||||
@@ -575,7 +577,7 @@ func (b *BtcWallet) ListAccounts(name string,
|
||||
// Only the name filter was provided.
|
||||
case name != "" && keyScope == nil:
|
||||
// If the name corresponds to the default or imported accounts,
|
||||
// we'll return them for both of our supported key scopes.
|
||||
// we'll return them for all our supported key scopes.
|
||||
if name == lnwallet.DefaultAccountName ||
|
||||
name == waddrmgr.ImportedAddrAccountName {
|
||||
|
||||
@@ -594,6 +596,14 @@ func (b *BtcWallet) ListAccounts(name string,
|
||||
return nil, err
|
||||
}
|
||||
res = append(res, a2)
|
||||
|
||||
a3, err := b.wallet.AccountPropertiesByName(
|
||||
waddrmgr.KeyScopeBIP0086, name,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = append(res, a3)
|
||||
break
|
||||
}
|
||||
|
||||
@@ -642,6 +652,15 @@ func (b *BtcWallet) ListAccounts(name string,
|
||||
res = append(res, &account.AccountProperties)
|
||||
}
|
||||
|
||||
accounts, err = b.wallet.Accounts(waddrmgr.KeyScopeBIP0086)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, account := range accounts.Accounts {
|
||||
account := account
|
||||
res = append(res, &account.AccountProperties)
|
||||
}
|
||||
|
||||
accounts, err = b.wallet.Accounts(waddrmgr.KeyScope{
|
||||
Purpose: keychain.BIP0043Purpose,
|
||||
Coin: b.cfg.CoinType,
|
||||
@@ -912,10 +931,13 @@ func (b *BtcWallet) ListUnspentWitness(minConfs, maxConfs int32,
|
||||
// wallet are nested p2pkh. We can't check the redeem script because
|
||||
// the btcwallet service does not include it.
|
||||
addressType = lnwallet.NestedWitnessPubKey
|
||||
} else if txscript.IsPayToTaproot(pkScript) {
|
||||
addressType = lnwallet.TaprootPubkey
|
||||
}
|
||||
|
||||
if addressType == lnwallet.WitnessPubKey ||
|
||||
addressType == lnwallet.NestedWitnessPubKey {
|
||||
addressType == lnwallet.NestedWitnessPubKey ||
|
||||
addressType == lnwallet.TaprootPubkey {
|
||||
|
||||
txid, err := chainhash.NewHashFromStr(output.TxID)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user