lnwallet: fix InternalKeyForAddr for imported addr

An address imported using ImportTapscript doesn't provide a private key
so it can't satisfy waddrmgr.ManagedPubKeyAddress interface. So we don't
return an error for imported addresses.
Fix https://github.com/lightninglabs/loop/issues/923
This commit is contained in:
Boris Nagaev committed 2025-04-23 11:17:00 -03:00
1 parent b5c9df81f0
commit 429000e360
1 file changed
+6
+6
View File
@@ -660,6 +660,12 @@ func InternalKeyForAddr(wallet WalletController, netParams *chaincfg.Params,
return none, nil
}
// Imported addresses do not provide private keys, so they do not
// implement waddrmgr.ManagedPubKeyAddress. See RPC ImportTapscript.
if walletAddr.Imported() {
return none, nil
}
pubKeyAddr, ok := walletAddr.(waddrmgr.ManagedPubKeyAddress)
if !ok {
return none, fmt.Errorf("expected pubkey addr, got %T",