chainntnfs: fix test testSingleConfirmationNotification

This commit is contained in:
yyforyongyu committed 2024-12-20 22:08:32 +08:00
1 parent a388c1f39d
commit bafe5d009f
1 file changed
+7 -3
+7 -3
View File
@@ -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]) {