Skip to content

Commit cd363ab

Browse files
committed
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 lightninglabs/loop#923
1 parent a46024b commit cd363ab

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lnwallet/interface.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,14 @@ func InternalKeyForAddr(wallet WalletController, netParams *chaincfg.Params,
662662

663663
pubKeyAddr, ok := walletAddr.(waddrmgr.ManagedPubKeyAddress)
664664
if !ok {
665+
// Imported addresses do not provide private keys, so they
666+
// do not implement waddrmgr.ManagedPubKeyAddress.
667+
// See RPC ImportTapscript.
668+
// Fix https://github.com/lightninglabs/loop/issues/923
669+
if walletAddr.Imported() {
670+
return none, nil
671+
}
672+
665673
return none, fmt.Errorf("expected pubkey addr, got %T",
666674
walletAddr)
667675
}

0 commit comments

Comments
 (0)