itest+lntest: add itest testSweepHTLCs to check HTLC sweepings

This commit is contained in:
yyforyongyu committed 2024-04-19 21:33:36 +08:00
1 parent 94e0e32c74
commit a1a480a81c
5 files changed
+527 -7

No files matched your search

+24
View File
@@ -476,6 +476,30 @@ func (h *HarnessMiner) MineBlockWithTxes(txes []*btcutil.Tx) *wire.MsgBlock {
block, err := h.Client.GetBlock(b.Hash())
require.NoError(h, err, "unable to get block")
// Make sure the mempool has been updated.
for _, tx := range txes {
h.AssertTxNotInMempool(*tx.Hash())
}
return block
}
// MineBlocksWithTx mines a single block to include the specifies tx only.
func (h *HarnessMiner) MineBlockWithTx(tx *wire.MsgTx) *wire.MsgBlock {
var emptyTime time.Time
txes := []*btcutil.Tx{btcutil.NewTx(tx)}
// Generate a block.
b, err := h.GenerateAndSubmitBlock(txes, -1, emptyTime)
require.NoError(h, err, "unable to mine block")
block, err := h.Client.GetBlock(b.Hash())
require.NoError(h, err, "unable to get block")
// Make sure the mempool has been updated.
h.AssertTxNotInMempool(tx.TxHash())
return block
}