mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-19 12:01:27 +02: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:
committed by
Oliver Gugger
parent
615f3d633e
commit
552d182594
@@ -632,6 +632,19 @@ func InternalKeyForAddr(wallet WalletController, netParams *chaincfg.Params,
|
|||||||
|
|
||||||
walletAddr, err := wallet.AddressInfo(addr)
|
walletAddr, err := wallet.AddressInfo(addr)
|
||||||
if err != nil {
|
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
|
return none, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user