lnwallet: add test to ensure that all backends show unconf txns in ListTransactionDetails

In this commit, we add a new test to the set of lnwallet integration
tests. In this new test, we aim to ensure that all backends are able to
display unconfirmed transactions in ListChainTransactions. As of this
commit, this test fails as no backends will return unconfirmed
transactions properly.
This commit is contained in:
Olaoluwa Osuntokun 2018-09-12 20:51:27 -07:00
parent 20460432d5
commit 24f9504e27
No known key found for this signature in database
GPG Key ID: CE58F7F8E20FD9A2

@ -1055,7 +1055,9 @@ func testListTransactionDetails(miner *rpctest.Harness,
delete(txids, txDetail.Hash)
}
if len(txids) != 0 {
t.Fatalf("all transactions not found in details!")
t.Fatalf("all transactions not found in details: left=%v, "+
"returned_set=%v", spew.Sdump(txids),
spew.Sdump(txDetails))
}
// Next create a transaction paying to an output which isn't under the
@ -1075,6 +1077,41 @@ func testListTransactionDetails(miner *rpctest.Harness,
if err != nil {
t.Fatalf("tx not relayed to miner: %v", err)
}
// Before we mine the next block, we'll ensure that the above
// transaction shows up in the set of unconfirmed transactions returned
// by ListTransactionDetails.
err = waitForWalletSync(miner, alice)
if err != nil {
t.Fatalf("Couldn't sync Alice's wallet: %v", err)
}
// We should be able to find the transaction above in the set of
// returned transactions, and it should have a confirmation of -1,
// indicating that it's not yet mined.
txDetails, err = alice.ListTransactionDetails()
if err != nil {
t.Fatalf("unable to fetch tx details: %v", err)
}
var mempoolTxFound bool
for _, txDetail := range txDetails {
if !bytes.Equal(txDetail.Hash[:], burnTXID[:]) {
continue
}
// Now that we've found the transaction, ensure that it has a
// negative number of confirmations to indicate that it's
// unconfirmed.
mempoolTxFound = true
if txDetail.NumConfirmations != 0 {
t.Fatalf("num confs incorrect, got %v expected %v",
txDetail.NumConfirmations, 0)
}
}
if !mempoolTxFound {
t.Fatalf("unable to find mempool tx in tx details!")
}
burnBlock, err := miner.Node.Generate(1)
if err != nil {
t.Fatalf("unable to mine block: %v", err)