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.
This commit is contained in:
Olaoluwa Osuntokun 2018-09-12 20:53:52 -07:00
parent 24f9504e27
commit 2509ecd8d8
No known key found for this signature in database
GPG Key ID: CE58F7F8E20FD9A2

@ -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