diff --git a/lnwallet/interface_test.go b/lnwallet/interface_test.go index eb2be23e3..cd1125831 100644 --- a/lnwallet/interface_test.go +++ b/lnwallet/interface_test.go @@ -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)