lntest+itest: strictly define the behavior of MineBlocks

This commit adds more assertion to `MineBlocks` so the caller won't
misuse it.
This commit is contained in:
yyforyongyu authored and yyforyongyu committed 2024-07-23 21:30:07 +08:00
1 parent 91b20e661b
commit e553895ddd
8 files changed
+52 -31

No files matched your search

+7 -7
View File
@@ -1414,24 +1414,24 @@ func (h *HarnessTest) fundCoins(amt btcutil.Amount, target *node.HarnessNode,
pkScriptStr := utxos[0].PkScript
require.Equal(h, pkScriptStr, expPkScriptStr,
"pkscript mismatch")
expectedBalance := btcutil.Amount(
initialBalance.UnconfirmedBalance,
) + amt
h.WaitForBalanceUnconfirmed(target, expectedBalance)
}
// If the transaction should remain unconfirmed, then we'll wait until
// the target node's unconfirmed balance reflects the expected balance
// and exit.
if !confirmed && !h.IsNeutrinoBackend() {
expectedBalance := btcutil.Amount(
initialBalance.UnconfirmedBalance,
) + amt
h.WaitForBalanceUnconfirmed(target, expectedBalance)
if !confirmed {
return
}
// Otherwise, we'll generate 1 new blocks to ensure the output gains a
// sufficient number of confirmations and wait for the balance to
// reflect what's expected.
h.MineBlocks(1)
h.MineBlocksAndAssertNumTxes(1, 1)
expectedBalance := btcutil.Amount(initialBalance.ConfirmedBalance) + amt
h.WaitForBalanceConfirmed(target, expectedBalance)