From 2509ecd8d8c69785c0832001bc4307684005fbfe Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Wed, 12 Sep 2018 20:53:52 -0700 Subject: [PATCH] lnwallet: fix ListTransactionDetails to ensure unconfirmed transactions are installed In this commit, we fix a bug in the arguments to GetTransactions for the btcwallet implementation of the WalletController interface. Before this commit, we wouldn't properly return unconfirmed transactions. The issue was that we didn't specify the special mempool height of "-1", as the ending height. The mempool height is actually internally converted to the highest possible height that can fit into a int32. In this commit, we set the start to zero, and end to -1 (actually 2^32-1) to properly scan for unconfirmed transactions. Fixes #1422. --- lnwallet/btcwallet/btcwallet.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lnwallet/btcwallet/btcwallet.go b/lnwallet/btcwallet/btcwallet.go index 92bcbfa2..3fb7665c 100644 --- a/lnwallet/btcwallet/btcwallet.go +++ b/lnwallet/btcwallet/btcwallet.go @@ -559,9 +559,11 @@ func (b *BtcWallet) ListTransactionDetails() ([]*lnwallet.TransactionDetail, err bestBlock := b.wallet.Manager.SyncedTo() currentHeight := bestBlock.Height - // TODO(roasbeef): can replace with start "wallet birthday" + // We'll attempt to find all unconfirmed transactions (height of -1), + // as well as all transactions that are known to have confirmed at this + // height. start := base.NewBlockIdentifierFromHeight(0) - stop := base.NewBlockIdentifierFromHeight(bestBlock.Height) + stop := base.NewBlockIdentifierFromHeight(-1) txns, err := b.wallet.GetTransactions(start, stop, nil) if err != nil { return nil, err