From bafe5d009f2288c2be7c0461e278d5f327225bad Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Thu, 19 Dec 2024 23:11:52 +0800 Subject: [PATCH] chainntnfs: fix test `testSingleConfirmationNotification` --- chainntnfs/test/test_interface.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/chainntnfs/test/test_interface.go b/chainntnfs/test/test_interface.go index 99daf54f1e..fd42b10de7 100644 --- a/chainntnfs/test/test_interface.go +++ b/chainntnfs/test/test_interface.go @@ -41,9 +41,8 @@ func testSingleConfirmationNotification(miner *rpctest.Harness, // function. txid, pkScript, err := chainntnfs.GetTestTxidAndScript(miner) require.NoError(t, err, "unable to create test tx") - if err := chainntnfs.WaitForMempoolTx(miner, txid); err != nil { - t.Fatalf("tx not relayed to miner: %v", err) - } + err = chainntnfs.WaitForMempoolTx(miner, txid) + require.NoError(t, err, "tx not relayed to miner") _, currentHeight, err := miner.Client.GetBestBlock() require.NoError(t, err, "unable to get current height") @@ -68,6 +67,11 @@ func testSingleConfirmationNotification(miner *rpctest.Harness, blockHash, err := miner.Client.Generate(1) require.NoError(t, err, "unable to generate single block") + // Assert the above tx is mined in the block. + block, err := miner.Client.GetBlock(blockHash[0]) + require.NoError(t, err) + require.Len(t, block.Transactions, 2, "block does not contain tx") + select { case confInfo := <-confIntent.Confirmed: if !confInfo.BlockHash.IsEqual(blockHash[0]) {