mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
lnwallet: fix closechannel for P2TR external addr
If the delivery address is P2TR, function InternalKeyForAddr checks its existance in the wallet to return internal key for it in case it is a custom taproot channel. It used to return the error returned by wallet.AddressInfo. The error is now ignored if it is ErrAddressNotFound error. This fixes "lncli closechannel --delivery_addr <external p2tr address" case.
This commit is contained in:
parent
c37baa68d8
commit
9fec11eeb5
@ -636,6 +636,19 @@ func InternalKeyForAddr(wallet WalletController, netParams *chaincfg.Params,
|
||||
|
||||
walletAddr, err := wallet.AddressInfo(addr)
|
||||
if err != nil {
|
||||
// If the error is that the address can't be found, it is not
|
||||
// an error. This happens when any channel which is not a custom
|
||||
// taproot channel is cooperatively closed to an external P2TR
|
||||
// address. In this case there is no internal key associated
|
||||
// with the address. Callers can use the .Option() method to get
|
||||
// an option value.
|
||||
var managerErr waddrmgr.ManagerError
|
||||
if errors.As(err, &managerErr) &&
|
||||
managerErr.ErrorCode == waddrmgr.ErrAddressNotFound {
|
||||
|
||||
return none, nil
|
||||
}
|
||||
|
||||
return none, err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user