lnwallet: expose required account parameter for WalletController methods

This commit is contained in:
Wilmer Paulino 2021-02-19 17:41:45 -08:00
parent a620ce3682
commit f38bf4d7fa
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F
11 changed files with 239 additions and 96 deletions

@ -1372,7 +1372,10 @@ func (f *Manager) handleFundingOpen(peer lnpeer.Peer,
shutdown, err := getUpfrontShutdownScript(
f.cfg.EnableUpfrontShutdown, peer, acceptorResp.UpfrontShutdown,
func() (lnwire.DeliveryAddress, error) {
addr, err := f.cfg.Wallet.NewAddress(lnwallet.WitnessPubKey, false)
addr, err := f.cfg.Wallet.NewAddress(
lnwallet.WitnessPubKey, false,
lnwallet.DefaultAccountName,
)
if err != nil {
return nil, err
}
@ -3153,6 +3156,7 @@ func (f *Manager) handleInitFundingMsg(msg *InitFundingMsg) {
func() (lnwire.DeliveryAddress, error) {
addr, err := f.cfg.Wallet.NewAddress(
lnwallet.WitnessPubKey, false,
lnwallet.DefaultAccountName,
)
if err != nil {
return nil, err

1
lnd.go

@ -676,6 +676,7 @@ func Main(cfg *Config, lisCfg ListenerCfg, interceptor signal.Interceptor) error
NewAddress: func() (btcutil.Address, error) {
return activeChainControl.Wallet.NewAddress(
lnwallet.WitnessPubKey, false,
lnwallet.DefaultAccountName,
)
},
NodeKeyECDH: keychain.NewPubKeyECDH(

@ -487,7 +487,9 @@ func (w *WalletKit) DeriveKey(ctx context.Context,
func (w *WalletKit) NextAddr(ctx context.Context,
req *AddrRequest) (*AddrResponse, error) {
addr, err := w.cfg.Wallet.NewAddress(lnwallet.WitnessPubKey, false)
addr, err := w.cfg.Wallet.NewAddress(
lnwallet.WitnessPubKey, false, lnwallet.DefaultAccountName,
)
if err != nil {
return nil, err
}
@ -1073,7 +1075,9 @@ func (w *WalletKit) FundPsbt(_ context.Context,
// We can now ask the wallet to fund the TX. This will not yet
// lock any coins but might still change the wallet DB by
// generating a new change address.
changeIndex, err = w.cfg.Wallet.FundPsbt(packet, feeSatPerKW)
changeIndex, err = w.cfg.Wallet.FundPsbt(
packet, feeSatPerKW, lnwallet.DefaultAccountName,
)
if err != nil {
return fmt.Errorf("wallet couldn't fund PSBT: %v", err)
}

@ -58,7 +58,7 @@ func (w *WalletController) ConfirmedBalance(confs int32) (btcutil.Amount, error)
// NewAddress is called to get new addresses for delivery, change etc.
func (w *WalletController) NewAddress(addrType lnwallet.AddressType,
change bool) (btcutil.Address, error) {
change bool, _ string) (btcutil.Address, error) {
addr, _ := btcutil.NewAddressPubKey(
w.RootKey.PubKey().SerializeCompressed(), &chaincfg.MainNetParams,
@ -67,8 +67,8 @@ func (w *WalletController) NewAddress(addrType lnwallet.AddressType,
}
// LastUnusedAddress currently returns dummy values.
func (w *WalletController) LastUnusedAddress(addrType lnwallet.AddressType) (
btcutil.Address, error) {
func (w *WalletController) LastUnusedAddress(addrType lnwallet.AddressType,
_ string) (btcutil.Address, error) {
return nil, nil
}
@ -148,13 +148,13 @@ func (w *WalletController) ListLeasedOutputs() ([]*wtxmgr.LockedOutput, error) {
// FundPsbt currently does nothing.
func (w *WalletController) FundPsbt(_ *psbt.Packet,
_ chainfee.SatPerKWeight) (int32, error) {
_ chainfee.SatPerKWeight, _ string) (int32, error) {
return 0, nil
}
// FinalizePsbt currently does nothing.
func (w *WalletController) FinalizePsbt(_ *psbt.Packet) error {
func (w *WalletController) FinalizePsbt(_ *psbt.Packet, _ string) error {
return nil
}

@ -3,6 +3,7 @@ package btcwallet
import (
"bytes"
"encoding/hex"
"errors"
"fmt"
"math"
"sync"
@ -27,7 +28,8 @@ import (
)
const (
defaultAccount = uint32(waddrmgr.DefaultAccountNum)
defaultAccount = uint32(waddrmgr.DefaultAccountNum)
importedAccount = uint32(waddrmgr.ImportedAddrAccount)
// UnconfirmedHeight is the special case end height that is used to
// obtain unconfirmed transactions from ListTransactionDetails.
@ -46,6 +48,11 @@ var (
ExternalAddrType: waddrmgr.WitnessPubKey,
InternalAddrType: waddrmgr.WitnessPubKey,
}
// errNoImportedAddrGen is an error returned when a new address is
// requested for the default imported account within the wallet.
errNoImportedAddrGen = errors.New("addresses cannot be generated for " +
"the default imported account")
)
// BtcWallet is an implementation of the lnwallet.WalletController interface
@ -237,26 +244,44 @@ func (b *BtcWallet) ConfirmedBalance(confs int32) (btcutil.Amount, error) {
// NewAddress returns the next external or internal address for the wallet
// dictated by the value of the `change` parameter. If change is true, then an
// internal address will be returned, otherwise an external address should be
// returned.
// returned. The account parameter must be non-empty as it determines which
// account the address should be generated from.
//
// This is a part of the WalletController interface.
func (b *BtcWallet) NewAddress(t lnwallet.AddressType, change bool) (btcutil.Address, error) {
var keyScope waddrmgr.KeyScope
func (b *BtcWallet) NewAddress(t lnwallet.AddressType, change bool,
accountName string) (btcutil.Address, error) {
var (
keyScope waddrmgr.KeyScope
account uint32
)
switch accountName {
case waddrmgr.ImportedAddrAccountName:
return nil, errNoImportedAddrGen
case lnwallet.DefaultAccountName:
switch t {
case lnwallet.WitnessPubKey:
keyScope = waddrmgr.KeyScopeBIP0084
case lnwallet.NestedWitnessPubKey:
keyScope = waddrmgr.KeyScopeBIP0049Plus
default:
return nil, fmt.Errorf("unknown address type")
}
account = defaultAccount
switch t {
case lnwallet.WitnessPubKey:
keyScope = waddrmgr.KeyScopeBIP0084
case lnwallet.NestedWitnessPubKey:
keyScope = waddrmgr.KeyScopeBIP0049Plus
default:
return nil, fmt.Errorf("unknown address type")
var err error
keyScope, account, err = b.wallet.LookupAccount(accountName)
if err != nil {
return nil, err
}
}
if change {
return b.wallet.NewChangeAddress(defaultAccount, keyScope)
return b.wallet.NewChangeAddress(account, keyScope)
}
return b.wallet.NewAddress(defaultAccount, keyScope)
return b.wallet.NewAddress(account, keyScope)
}
// LastUnusedAddress returns the last *unused* address known by the wallet. An
@ -264,22 +289,39 @@ func (b *BtcWallet) NewAddress(t lnwallet.AddressType, change bool) (btcutil.Add
// UIs in order to continually show the "freshest" address without having to
// worry about "address inflation" caused by continual refreshing. Similar to
// NewAddress it can derive a specified address type, and also optionally a
// change address.
func (b *BtcWallet) LastUnusedAddress(addrType lnwallet.AddressType) (
btcutil.Address, error) {
// change address. The account parameter must be non-empty as it determines
// which account the address should be generated from.
func (b *BtcWallet) LastUnusedAddress(addrType lnwallet.AddressType,
accountName string) (btcutil.Address, error) {
var keyScope waddrmgr.KeyScope
var (
keyScope waddrmgr.KeyScope
account uint32
)
switch accountName {
case waddrmgr.ImportedAddrAccountName:
return nil, errNoImportedAddrGen
case lnwallet.DefaultAccountName:
switch addrType {
case lnwallet.WitnessPubKey:
keyScope = waddrmgr.KeyScopeBIP0084
case lnwallet.NestedWitnessPubKey:
keyScope = waddrmgr.KeyScopeBIP0049Plus
default:
return nil, fmt.Errorf("unknown address type")
}
account = defaultAccount
switch addrType {
case lnwallet.WitnessPubKey:
keyScope = waddrmgr.KeyScopeBIP0084
case lnwallet.NestedWitnessPubKey:
keyScope = waddrmgr.KeyScopeBIP0049Plus
default:
return nil, fmt.Errorf("unknown address type")
var err error
keyScope, account, err = b.wallet.LookupAccount(accountName)
if err != nil {
return nil, err
}
}
return b.wallet.CurrentAddress(defaultAccount, keyScope)
return b.wallet.CurrentAddress(account, keyScope)
}
// IsOurAddress checks if the passed address belongs to this wallet
@ -698,49 +740,99 @@ func (b *BtcWallet) ListTransactionDetails(startHeight,
return txDetails, nil
}
// FundPsbt creates a fully populated PSBT packet that contains enough
// inputs to fund the outputs specified in the passed in packet with the
// specified fee rate. If there is change left, a change output from the
// internal wallet is added and the index of the change output is returned.
// Otherwise no additional output is created and the index -1 is returned.
// FundPsbt creates a fully populated PSBT packet that contains enough inputs to
// fund the outputs specified in the passed in packet with the specified fee
// rate. If there is change left, a change output from the internal wallet is
// added and the index of the change output is returned. Otherwise no additional
// output is created and the index -1 is returned.
//
// NOTE: If the packet doesn't contain any inputs, coin selection is
// performed automatically. If the packet does contain any inputs, it is
// assumed that full coin selection happened externally and no
// additional inputs are added. If the specified inputs aren't enough to
// fund the outputs with the given fee rate, an error is returned.
// No lock lease is acquired for any of the selected/validated inputs.
// It is in the caller's responsibility to lock the inputs before
// handing them out.
// NOTE: If the packet doesn't contain any inputs, coin selection is performed
// automatically. The account parameter must be non-empty as it determines which
// set of coins are eligible for coin selection. If the packet does contain any
// inputs, it is assumed that full coin selection happened externally and no
// additional inputs are added. If the specified inputs aren't enough to fund
// the outputs with the given fee rate, an error is returned. No lock lease is
// acquired for any of the selected/validated inputs. It is in the caller's
// responsibility to lock the inputs before handing them out.
//
// This is a part of the WalletController interface.
func (b *BtcWallet) FundPsbt(packet *psbt.Packet,
feeRate chainfee.SatPerKWeight) (int32, error) {
feeRate chainfee.SatPerKWeight, accountName string) (int32, error) {
// The fee rate is passed in using units of sat/kw, so we'll convert
// this to sat/KB as the CreateSimpleTx method requires this unit.
feeSatPerKB := btcutil.Amount(feeRate.FeePerKVByte())
var (
keyScope *waddrmgr.KeyScope
accountNum uint32
)
switch accountName {
// If the default/imported account name was specified, we'll provide a
// nil key scope to FundPsbt, allowing it to select inputs from both key
// scopes (NP2WKH, P2WKH).
case lnwallet.DefaultAccountName:
accountNum = defaultAccount
case waddrmgr.ImportedAddrAccountName:
accountNum = importedAccount
// Otherwise, map the account name to its key scope and internal account
// number to only select inputs from said account.
default:
scope, account, err := b.wallet.LookupAccount(accountName)
if err != nil {
return 0, err
}
keyScope = &scope
accountNum = account
}
// Let the wallet handle coin selection and/or fee estimation based on
// the partial TX information in the packet.
return b.wallet.FundPsbt(packet, nil, defaultAccount, feeSatPerKB)
return b.wallet.FundPsbt(packet, keyScope, accountNum, feeSatPerKB)
}
// FinalizePsbt expects a partial transaction with all inputs and
// outputs fully declared and tries to sign all inputs that belong to
// the wallet. Lnd must be the last signer of the transaction. That
// means, if there are any unsigned non-witness inputs or inputs without
// UTXO information attached or inputs without witness data that do not
// belong to lnd's wallet, this method will fail. If no error is
// returned, the PSBT is ready to be extracted and the final TX within
// to be broadcast.
// FinalizePsbt expects a partial transaction with all inputs and outputs fully
// declared and tries to sign all inputs that belong to the specified account.
// Lnd must be the last signer of the transaction. That means, if there are any
// unsigned non-witness inputs or inputs without UTXO information attached or
// inputs without witness data that do not belong to lnd's wallet, this method
// will fail. If no error is returned, the PSBT is ready to be extracted and the
// final TX within to be broadcast.
//
// NOTE: This method does NOT publish the transaction after it's been
// finalized successfully.
//
// This is a part of the WalletController interface.
func (b *BtcWallet) FinalizePsbt(packet *psbt.Packet) error {
return b.wallet.FinalizePsbt(nil, defaultAccount, packet)
func (b *BtcWallet) FinalizePsbt(packet *psbt.Packet, accountName string) error {
var (
keyScope *waddrmgr.KeyScope
accountNum uint32
)
switch accountName {
// If the default/imported account name was specified, we'll provide a
// nil key scope to FundPsbt, allowing it to sign inputs from both key
// scopes (NP2WKH, P2WKH).
case lnwallet.DefaultAccountName:
accountNum = defaultAccount
case waddrmgr.ImportedAddrAccountName:
accountNum = importedAccount
// Otherwise, map the account name to its key scope and internal account
// number to determine if the inputs belonging to this account should be
// signed.
default:
scope, account, err := b.wallet.LookupAccount(accountName)
if err != nil {
return err
}
keyScope = &scope
accountNum = account
}
return b.wallet.FinalizePsbt(keyScope, accountNum, packet)
}
// txSubscriptionClient encapsulates the transaction notification client from

@ -17,6 +17,12 @@ import (
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
)
const (
// DefaultAccountName is the name for the default account used to manage
// on-chain funds within the wallet.
DefaultAccountName = "default"
)
// AddressType is an enum-like type which denotes the possible address types
// WalletController supports.
type AddressType uint8
@ -165,8 +171,10 @@ type WalletController interface {
// true, then an internal address should be used, otherwise an external
// address should be returned. The type of address returned is dictated
// by the wallet's capabilities, and may be of type: p2sh, p2wkh,
// p2wsh, etc.
NewAddress(addrType AddressType, change bool) (btcutil.Address, error)
// p2wsh, etc. The account parameter must be non-empty as it determines
// which account the address should be generated from.
NewAddress(addrType AddressType, change bool,
account string) (btcutil.Address, error)
// LastUnusedAddress returns the last *unused* address known by the
// wallet. An address is unused if it hasn't received any payments.
@ -174,7 +182,10 @@ type WalletController interface {
// "freshest" address without having to worry about "address inflation"
// caused by continual refreshing. Similar to NewAddress it can derive
// a specified address type. By default, this is a non-change address.
LastUnusedAddress(addrType AddressType) (btcutil.Address, error)
// The account parameter must be non-empty as it determines which
// account the address should be generated from.
LastUnusedAddress(addrType AddressType,
account string) (btcutil.Address, error)
// IsOurAddress checks if the passed address belongs to this wallet
IsOurAddress(a btcutil.Address) bool
@ -286,28 +297,29 @@ type WalletController interface {
// is returned.
//
// NOTE: If the packet doesn't contain any inputs, coin selection is
// performed automatically. If the packet does contain any inputs, it is
// assumed that full coin selection happened externally and no
// additional inputs are added. If the specified inputs aren't enough to
// fund the outputs with the given fee rate, an error is returned.
// No lock lease is acquired for any of the selected/validated inputs.
// It is in the caller's responsibility to lock the inputs before
// handing them out.
FundPsbt(packet *psbt.Packet, feeRate chainfee.SatPerKWeight) (int32,
error)
// performed automatically. The account parameter must be non-empty as
// it determines which set of coins are eligible for coin selection. If
// the packet does contain any inputs, it is assumed that full coin
// selection happened externally and no additional inputs are added. If
// the specified inputs aren't enough to fund the outputs with the given
// fee rate, an error is returned. No lock lease is acquired for any of
// the selected/validated inputs. It is in the caller's responsibility
// to lock the inputs before handing them out.
FundPsbt(packet *psbt.Packet, feeRate chainfee.SatPerKWeight,
account string) (int32, error)
// FinalizePsbt expects a partial transaction with all inputs and
// outputs fully declared and tries to sign all inputs that belong to
// the wallet. Lnd must be the last signer of the transaction. That
// means, if there are any unsigned non-witness inputs or inputs without
// UTXO information attached or inputs without witness data that do not
// belong to lnd's wallet, this method will fail. If no error is
// returned, the PSBT is ready to be extracted and the final TX within
// to be broadcast.
// the specified account. Lnd must be the last signer of the
// transaction. That means, if there are any unsigned non-witness inputs
// or inputs without UTXO information attached or inputs without witness
// data that do not belong to lnd's wallet, this method will fail. If no
// error is returned, the PSBT is ready to be extracted and the final TX
// within to be broadcast.
//
// NOTE: This method does NOT publish the transaction after it's been
// finalized successfully.
FinalizePsbt(packet *psbt.Packet) error
FinalizePsbt(packet *psbt.Packet, account string) error
// SubscribeTransactions returns a TransactionSubscription client which
// is capable of receiving async notifications as new transactions

@ -157,7 +157,7 @@ func newPkScript(t *testing.T, w *lnwallet.LightningWallet,
t.Helper()
addr, err := w.NewAddress(addrType, false)
addr, err := w.NewAddress(addrType, false, lnwallet.DefaultAccountName)
if err != nil {
t.Fatalf("unable to create new address: %v", err)
}
@ -256,7 +256,10 @@ func loadTestCredits(miner *rpctest.Harness, w *lnwallet.LightningWallet,
addrs := make([]btcutil.Address, 0, numOutputs)
for i := 0; i < numOutputs; i++ {
// Grab a fresh address from the wallet to house this output.
walletAddr, err := w.NewAddress(lnwallet.WitnessPubKey, false)
walletAddr, err := w.NewAddress(
lnwallet.WitnessPubKey, false,
lnwallet.DefaultAccountName,
)
if err != nil {
return err
}
@ -1138,7 +1141,10 @@ func testListTransactionDetails(miner *rpctest.Harness,
const outputAmt = btcutil.SatoshiPerBitcoin
txids := make(map[chainhash.Hash]struct{})
for i := 0; i < numTxns; i++ {
addr, err := alice.NewAddress(lnwallet.WitnessPubKey, false)
addr, err := alice.NewAddress(
lnwallet.WitnessPubKey, false,
lnwallet.DefaultAccountName,
)
if err != nil {
t.Fatalf("unable to create new address: %v", err)
}
@ -1465,7 +1471,10 @@ func testTransactionSubscriptions(miner *rpctest.Harness,
// Next, fetch a fresh address from the wallet, create 3 new outputs
// with the pkScript.
for i := 0; i < numTxns; i++ {
addr, err := alice.NewAddress(lnwallet.WitnessPubKey, false)
addr, err := alice.NewAddress(
lnwallet.WitnessPubKey, false,
lnwallet.DefaultAccountName,
)
if err != nil {
t.Fatalf("unable to create new address: %v", err)
}
@ -2493,11 +2502,15 @@ func testLastUnusedAddr(miner *rpctest.Harness,
lnwallet.WitnessPubKey, lnwallet.NestedWitnessPubKey,
}
for _, addrType := range addrTypes {
addr1, err := alice.LastUnusedAddress(addrType)
addr1, err := alice.LastUnusedAddress(
addrType, lnwallet.DefaultAccountName,
)
if err != nil {
t.Fatalf("unable to get addr: %v", err)
}
addr2, err := alice.LastUnusedAddress(addrType)
addr2, err := alice.LastUnusedAddress(
addrType, lnwallet.DefaultAccountName,
)
if err != nil {
t.Fatalf("unable to get addr: %v", err)
}
@ -2523,7 +2536,9 @@ func testLastUnusedAddr(miner *rpctest.Harness,
// If we make a new address, then it should be brand new, as
// the prior address has been used.
addr3, err := alice.LastUnusedAddress(addrType)
addr3, err := alice.LastUnusedAddress(
addrType, lnwallet.DefaultAccountName,
)
if err != nil {
t.Fatalf("unable to get addr: %v", err)
}
@ -2997,7 +3012,10 @@ func testSingleFunderExternalFundingTx(miner *rpctest.Harness,
MinConfs: 1,
FeeRate: 253,
ChangeAddr: func() (btcutil.Address, error) {
return alice.NewAddress(lnwallet.WitnessPubKey, true)
return alice.NewAddress(
lnwallet.WitnessPubKey, true,
lnwallet.DefaultAccountName,
)
},
})
if err != nil {
@ -3042,7 +3060,10 @@ func testSingleFunderExternalFundingTx(miner *rpctest.Harness,
MinConfs: 1,
FeeRate: 253,
ChangeAddr: func() (btcutil.Address, error) {
return bob.NewAddress(lnwallet.WitnessPubKey, true)
return bob.NewAddress(
lnwallet.WitnessPubKey, true,
lnwallet.DefaultAccountName,
)
},
})
if err != nil {

@ -722,7 +722,9 @@ func (l *LightningWallet) handleFundingReserveRequest(req *InitFundingReserveMsg
SubtractFees: req.SubtractFees,
FeeRate: req.FundingFeePerKw,
ChangeAddr: func() (btcutil.Address, error) {
return l.NewAddress(WitnessPubKey, true)
return l.NewAddress(
WitnessPubKey, true, DefaultAccountName,
)
},
}
fundingIntent, err = req.ChanFunder.ProvisionChannel(

@ -2043,7 +2043,7 @@ func (p *Brontide) ChannelSnapshots() []*channeldb.ChannelSnapshot {
// the case of a cooperative channel close negotiation.
func (p *Brontide) genDeliveryScript() ([]byte, error) {
deliveryAddr, err := p.cfg.Wallet.NewAddress(
lnwallet.WitnessPubKey, false,
lnwallet.WitnessPubKey, false, lnwallet.DefaultAccountName,
)
if err != nil {
return nil, err
@ -2333,10 +2333,14 @@ func (p *Brontide) fetchActiveChanCloser(chanID lnwire.ChannelID) (
"channel w/ active htlcs")
}
// We'll create a valid closing state machine in order to respond to the
// initiated cooperative channel closure. First, we set the delivery
// script that our funds will be paid out to. If an upfront shutdown script
// was set, we will use it. Otherwise, we get a fresh delivery script.
// We'll create a valid closing state machine in order to
// respond to the initiated cooperative channel closure. First,
// we set the delivery script that our funds will be paid out
// to. If an upfront shutdown script was set, we will use it.
// Otherwise, we get a fresh delivery script.
//
// TODO: Expose option to allow upfront shutdown script from
// watch-only accounts.
deliveryScript := channel.LocalUpfrontShutdownScript()
if len(deliveryScript) == 0 {
var err error

@ -1225,6 +1225,7 @@ func (r *rpcServer) SendCoins(ctx context.Context,
// allowing us to pass the reserved value check.
changeAddr, err := r.server.cc.Wallet.NewAddress(
lnwallet.WitnessPubKey, true,
lnwallet.DefaultAccountName,
)
if err != nil {
return nil, err
@ -1381,7 +1382,7 @@ func (r *rpcServer) NewAddress(ctx context.Context,
switch in.Type {
case lnrpc.AddressType_WITNESS_PUBKEY_HASH:
addr, err = r.server.cc.Wallet.NewAddress(
lnwallet.WitnessPubKey, false,
lnwallet.WitnessPubKey, false, lnwallet.DefaultAccountName,
)
if err != nil {
return nil, err
@ -1389,7 +1390,7 @@ func (r *rpcServer) NewAddress(ctx context.Context,
case lnrpc.AddressType_NESTED_PUBKEY_HASH:
addr, err = r.server.cc.Wallet.NewAddress(
lnwallet.NestedWitnessPubKey, false,
lnwallet.NestedWitnessPubKey, false, lnwallet.DefaultAccountName,
)
if err != nil {
return nil, err
@ -1397,7 +1398,7 @@ func (r *rpcServer) NewAddress(ctx context.Context,
case lnrpc.AddressType_UNUSED_WITNESS_PUBKEY_HASH:
addr, err = r.server.cc.Wallet.LastUnusedAddress(
lnwallet.WitnessPubKey,
lnwallet.WitnessPubKey, lnwallet.DefaultAccountName,
)
if err != nil {
return nil, err
@ -1405,7 +1406,7 @@ func (r *rpcServer) NewAddress(ctx context.Context,
case lnrpc.AddressType_UNUSED_NESTED_PUBKEY_HASH:
addr, err = r.server.cc.Wallet.LastUnusedAddress(
lnwallet.NestedWitnessPubKey,
lnwallet.NestedWitnessPubKey, lnwallet.DefaultAccountName,
)
if err != nil {
return nil, err

@ -3809,7 +3809,9 @@ func newSweepPkScriptGen(
wallet lnwallet.WalletController) func() ([]byte, error) {
return func() ([]byte, error) {
sweepAddr, err := wallet.NewAddress(lnwallet.WitnessPubKey, false)
sweepAddr, err := wallet.NewAddress(
lnwallet.WitnessPubKey, false, lnwallet.DefaultAccountName,
)
if err != nil {
return nil, err
}