Merge pull request #9378 from yyforyongyu/fix-unit-test

chainntnfs: fix test `testSingleConfirmationNotification`
This commit is contained in:
Oliver Gugger 2025-01-13 03:13:02 -06:00 committed by GitHub
commit 1b0f41da48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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]) {