lntest+itest: continue removing direct call to Miner
This commit is contained in:
1 parent
976bb37972
commit
6bd8baea38
18 files changed
+124
-93
No files matched your search
@@ -624,7 +624,7 @@ func runChanRestoreScenarioCommitTypes(ht *lntest.HarnessTest,
|
|||||||
|
|
||||||
var fundingShim *lnrpc.FundingShim
|
var fundingShim *lnrpc.FundingShim
|
||||||
if ct == lnrpc.CommitmentType_SCRIPT_ENFORCED_LEASE {
|
if ct == lnrpc.CommitmentType_SCRIPT_ENFORCED_LEASE {
|
||||||
_, minerHeight := ht.Miner.GetBestBlock()
|
_, minerHeight := ht.GetBestBlock()
|
||||||
thawHeight := uint32(minerHeight + thawHeightDelta)
|
thawHeight := uint32(minerHeight + thawHeightDelta)
|
||||||
|
|
||||||
fundingShim, _ = deriveFundingShim(
|
fundingShim, _ = deriveFundingShim(
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ func channelForceClosureTest(ht *lntest.HarnessTest,
|
|||||||
|
|
||||||
// Fetch starting height of this test so we can compute the block
|
// Fetch starting height of this test so we can compute the block
|
||||||
// heights we expect certain events to take place.
|
// heights we expect certain events to take place.
|
||||||
_, curHeight := ht.Miner.GetBestBlock()
|
_, curHeight := ht.GetBestBlock()
|
||||||
|
|
||||||
// Using the current height of the chain, derive the relevant heights
|
// Using the current height of the chain, derive the relevant heights
|
||||||
// for incubating two-stage htlcs.
|
// for incubating two-stage htlcs.
|
||||||
@@ -214,7 +214,7 @@ func channelForceClosureTest(ht *lntest.HarnessTest,
|
|||||||
ht.AssertNumUTXOs(alice, expectedUtxos)
|
ht.AssertNumUTXOs(alice, expectedUtxos)
|
||||||
|
|
||||||
// We expect to see Alice's force close tx in the mempool.
|
// We expect to see Alice's force close tx in the mempool.
|
||||||
ht.Miner.GetNumTxsFromMempool(1)
|
ht.GetNumTxsFromMempool(1)
|
||||||
|
|
||||||
// Mine a block which should confirm the commitment transaction
|
// Mine a block which should confirm the commitment transaction
|
||||||
// broadcast as a result of the force closure. Once mined, we also
|
// broadcast as a result of the force closure. Once mined, we also
|
||||||
@@ -278,7 +278,7 @@ func channelForceClosureTest(ht *lntest.HarnessTest,
|
|||||||
|
|
||||||
// Carol's sweep tx should be in the mempool already, as her output is
|
// Carol's sweep tx should be in the mempool already, as her output is
|
||||||
// not timelocked.
|
// not timelocked.
|
||||||
carolTx := ht.Miner.GetNumTxsFromMempool(1)[0]
|
carolTx := ht.GetNumTxsFromMempool(1)[0]
|
||||||
|
|
||||||
// Carol's sweeping tx should have 2-input-1-output shape.
|
// Carol's sweeping tx should have 2-input-1-output shape.
|
||||||
require.Len(ht, carolTx.TxIn, 2)
|
require.Len(ht, carolTx.TxIn, 2)
|
||||||
@@ -431,7 +431,7 @@ func channelForceClosureTest(ht *lntest.HarnessTest,
|
|||||||
ht.MineBlocksAndAssertNumTxes(1, 1)
|
ht.MineBlocksAndAssertNumTxes(1, 1)
|
||||||
|
|
||||||
// Update current height
|
// Update current height
|
||||||
_, curHeight = ht.Miner.GetBestBlock()
|
_, curHeight = ht.GetBestBlock()
|
||||||
|
|
||||||
// checkForceClosedChannelNumHtlcs verifies that a force closed channel
|
// checkForceClosedChannelNumHtlcs verifies that a force closed channel
|
||||||
// has the proper number of htlcs.
|
// has the proper number of htlcs.
|
||||||
@@ -485,7 +485,7 @@ func channelForceClosureTest(ht *lntest.HarnessTest,
|
|||||||
// number of blocks we have generated since adding it to the nursery,
|
// number of blocks we have generated since adding it to the nursery,
|
||||||
// and take an additional block off so that we end up one block shy of
|
// and take an additional block off so that we end up one block shy of
|
||||||
// the expiry height, and add the block padding.
|
// the expiry height, and add the block padding.
|
||||||
_, currentHeight := ht.Miner.GetBestBlock()
|
_, currentHeight := ht.GetBestBlock()
|
||||||
cltvHeightDelta := int(htlcExpiryHeight - uint32(currentHeight) - 1)
|
cltvHeightDelta := int(htlcExpiryHeight - uint32(currentHeight) - 1)
|
||||||
|
|
||||||
// Advance the blockchain until just before the CLTV expires, nothing
|
// Advance the blockchain until just before the CLTV expires, nothing
|
||||||
@@ -662,7 +662,7 @@ func channelForceClosureTest(ht *lntest.HarnessTest,
|
|||||||
|
|
||||||
// Advance the chain until just before the 2nd-layer CSV delays expire.
|
// Advance the chain until just before the 2nd-layer CSV delays expire.
|
||||||
// For anchor channels this is one block earlier.
|
// For anchor channels this is one block earlier.
|
||||||
_, currentHeight = ht.Miner.GetBestBlock()
|
_, currentHeight = ht.GetBestBlock()
|
||||||
ht.Logf("current height: %v, htlcCsvMaturityHeight=%v", currentHeight,
|
ht.Logf("current height: %v, htlcCsvMaturityHeight=%v", currentHeight,
|
||||||
htlcCsvMaturityHeight)
|
htlcCsvMaturityHeight)
|
||||||
numBlocks := int(htlcCsvMaturityHeight - uint32(currentHeight) - 2)
|
numBlocks := int(htlcCsvMaturityHeight - uint32(currentHeight) - 2)
|
||||||
|
|||||||
@@ -316,7 +316,7 @@ func testGraphTopologyNtfns(ht *lntest.HarnessTest, pinned bool) {
|
|||||||
ht.AssertNumNodeAnns(alice, alice.PubKeyStr, 1)
|
ht.AssertNumNodeAnns(alice, alice.PubKeyStr, 1)
|
||||||
ht.AssertNumNodeAnns(alice, bob.PubKeyStr, 1)
|
ht.AssertNumNodeAnns(alice, bob.PubKeyStr, 1)
|
||||||
|
|
||||||
_, blockHeight := ht.Miner.GetBestBlock()
|
_, blockHeight := ht.GetBestBlock()
|
||||||
|
|
||||||
// Now we'll test that updates are properly sent after channels are
|
// Now we'll test that updates are properly sent after channels are
|
||||||
// closed within the network.
|
// closed within the network.
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ func coopCloseWithHTLCs(ht *lntest.HarnessTest) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Wait for the close tx to be in the Mempool.
|
// Wait for the close tx to be in the Mempool.
|
||||||
ht.Miner.AssertTxInMempool(&closeTxid)
|
ht.AssertTxInMempool(&closeTxid)
|
||||||
|
|
||||||
// Wait for it to get mined and finish tearing down.
|
// Wait for it to get mined and finish tearing down.
|
||||||
ht.AssertStreamChannelCoopClosed(alice, chanPoint, false, closeClient)
|
ht.AssertStreamChannelCoopClosed(alice, chanPoint, false, closeClient)
|
||||||
|
|||||||
@@ -862,7 +862,7 @@ func testChannelFundingPersistence(ht *lntest.HarnessTest) {
|
|||||||
ht.AssertTxInBlock(block, fundingTxID)
|
ht.AssertTxInBlock(block, fundingTxID)
|
||||||
|
|
||||||
// Get the height that our transaction confirmed at.
|
// Get the height that our transaction confirmed at.
|
||||||
_, height := ht.Miner.GetBestBlock()
|
_, height := ht.GetBestBlock()
|
||||||
|
|
||||||
// Restart both nodes to test that the appropriate state has been
|
// Restart both nodes to test that the appropriate state has been
|
||||||
// persisted and that both nodes recover gracefully.
|
// persisted and that both nodes recover gracefully.
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ func testHoldInvoiceForceClose(ht *lntest.HarnessTest) {
|
|||||||
require.Len(ht, channel.PendingHtlcs, 1)
|
require.Len(ht, channel.PendingHtlcs, 1)
|
||||||
activeHtlc := channel.PendingHtlcs[0]
|
activeHtlc := channel.PendingHtlcs[0]
|
||||||
|
|
||||||
_, currentHeight := ht.Miner.GetBestBlock()
|
_, currentHeight := ht.GetBestBlock()
|
||||||
|
|
||||||
// Now we will mine blocks until the htlc expires, and wait for each
|
// Now we will mine blocks until the htlc expires, and wait for each
|
||||||
// node to sync to our latest height. Sanity check that we won't
|
// node to sync to our latest height. Sanity check that we won't
|
||||||
|
|||||||
+31
-31
@@ -248,7 +248,7 @@ func runMultiHopHtlcLocalTimeout(ht *lntest.HarnessTest,
|
|||||||
// Bob's force close transaction should now be found in the mempool.
|
// Bob's force close transaction should now be found in the mempool.
|
||||||
ht.AssertNumTxsInMempool(1)
|
ht.AssertNumTxsInMempool(1)
|
||||||
op := ht.OutPointFromChannelPoint(bobChanPoint)
|
op := ht.OutPointFromChannelPoint(bobChanPoint)
|
||||||
closeTx := ht.Miner.AssertOutpointInMempool(op)
|
closeTx := ht.AssertOutpointInMempool(op)
|
||||||
|
|
||||||
// Bob's anchor output should be offered to his sweep since Bob has
|
// Bob's anchor output should be offered to his sweep since Bob has
|
||||||
// time-sensitive HTLCs - we expect both anchors are offered.
|
// time-sensitive HTLCs - we expect both anchors are offered.
|
||||||
@@ -280,7 +280,7 @@ func runMultiHopHtlcLocalTimeout(ht *lntest.HarnessTest,
|
|||||||
|
|
||||||
htlcOutpoint := wire.OutPoint{Hash: closeTx.TxHash(), Index: 2}
|
htlcOutpoint := wire.OutPoint{Hash: closeTx.TxHash(), Index: 2}
|
||||||
commitOutpoint := wire.OutPoint{Hash: closeTx.TxHash(), Index: 3}
|
commitOutpoint := wire.OutPoint{Hash: closeTx.TxHash(), Index: 3}
|
||||||
htlcTimeoutTxid := ht.Miner.AssertOutpointInMempool(
|
htlcTimeoutTxid := ht.AssertOutpointInMempool(
|
||||||
htlcOutpoint,
|
htlcOutpoint,
|
||||||
).TxHash()
|
).TxHash()
|
||||||
|
|
||||||
@@ -330,7 +330,7 @@ func runMultiHopHtlcLocalTimeout(ht *lntest.HarnessTest,
|
|||||||
ht.AssertNumPendingSweeps(bob, 2)
|
ht.AssertNumPendingSweeps(bob, 2)
|
||||||
|
|
||||||
// Assert that the HTLC timeout tx is now in the mempool.
|
// Assert that the HTLC timeout tx is now in the mempool.
|
||||||
ht.Miner.AssertOutpointInMempool(htlcTimeoutOutpoint)
|
ht.AssertOutpointInMempool(htlcTimeoutOutpoint)
|
||||||
|
|
||||||
// We now wait for 30 seconds to overcome the flake - there's a
|
// We now wait for 30 seconds to overcome the flake - there's a
|
||||||
// block race between contractcourt and sweeper, causing the
|
// block race between contractcourt and sweeper, causing the
|
||||||
@@ -363,7 +363,7 @@ func runMultiHopHtlcLocalTimeout(ht *lntest.HarnessTest,
|
|||||||
pendingChanResp := bob.RPC.PendingChannels()
|
pendingChanResp := bob.RPC.PendingChannels()
|
||||||
if len(pendingChanResp.PendingForceClosingChannels) != 0 {
|
if len(pendingChanResp.PendingForceClosingChannels) != 0 {
|
||||||
// Check that the sweep spends the expected inputs.
|
// Check that the sweep spends the expected inputs.
|
||||||
ht.Miner.AssertOutpointInMempool(commitOutpoint)
|
ht.AssertOutpointInMempool(commitOutpoint)
|
||||||
ht.MineBlocksAndAssertNumTxes(1, 1)
|
ht.MineBlocksAndAssertNumTxes(1, 1)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -381,14 +381,14 @@ func runMultiHopHtlcLocalTimeout(ht *lntest.HarnessTest,
|
|||||||
ht.MineEmptyBlocks(1)
|
ht.MineEmptyBlocks(1)
|
||||||
|
|
||||||
// Check that the sweep spends from the mined commitment.
|
// Check that the sweep spends from the mined commitment.
|
||||||
ht.Miner.AssertOutpointInMempool(commitOutpoint)
|
ht.AssertOutpointInMempool(commitOutpoint)
|
||||||
|
|
||||||
// Mine one more block to trigger the timeout path.
|
// Mine one more block to trigger the timeout path.
|
||||||
ht.MineBlocksAndAssertNumTxes(1, 1)
|
ht.MineBlocksAndAssertNumTxes(1, 1)
|
||||||
|
|
||||||
// Bob's sweeper should now broadcast his second layer sweep
|
// Bob's sweeper should now broadcast his second layer sweep
|
||||||
// due to the CSV on the HTLC timeout output.
|
// due to the CSV on the HTLC timeout output.
|
||||||
ht.Miner.AssertOutpointInMempool(htlcTimeoutOutpoint)
|
ht.AssertOutpointInMempool(htlcTimeoutOutpoint)
|
||||||
|
|
||||||
// Next, we'll mine a final block that should confirm the
|
// Next, we'll mine a final block that should confirm the
|
||||||
// sweeping transactions left.
|
// sweeping transactions left.
|
||||||
@@ -503,7 +503,7 @@ func runMultiHopReceiverChainClaim(ht *lntest.HarnessTest,
|
|||||||
// transaction in order to go to the chain and sweep her HTLC.
|
// transaction in order to go to the chain and sweep her HTLC.
|
||||||
ht.AssertNumTxsInMempool(1)
|
ht.AssertNumTxsInMempool(1)
|
||||||
|
|
||||||
closingTx := ht.Miner.AssertOutpointInMempool(
|
closingTx := ht.AssertOutpointInMempool(
|
||||||
ht.OutPointFromChannelPoint(bobChanPoint),
|
ht.OutPointFromChannelPoint(bobChanPoint),
|
||||||
)
|
)
|
||||||
closingTxid := closingTx.TxHash()
|
closingTxid := closingTx.TxHash()
|
||||||
@@ -572,7 +572,7 @@ func runMultiHopReceiverChainClaim(ht *lntest.HarnessTest,
|
|||||||
ht.MineEmptyBlocks(1)
|
ht.MineEmptyBlocks(1)
|
||||||
|
|
||||||
// All transactions should be spending from the commitment transaction.
|
// All transactions should be spending from the commitment transaction.
|
||||||
txes := ht.Miner.GetNumTxsFromMempool(expectedTxes)
|
txes := ht.GetNumTxsFromMempool(expectedTxes)
|
||||||
ht.AssertAllTxesSpendFrom(txes, closingTxid)
|
ht.AssertAllTxesSpendFrom(txes, closingTxid)
|
||||||
|
|
||||||
// We'll now mine an additional block which should confirm both the
|
// We'll now mine an additional block which should confirm both the
|
||||||
@@ -644,7 +644,7 @@ func runMultiHopReceiverChainClaim(ht *lntest.HarnessTest,
|
|||||||
ht.MineEmptyBlocks(1)
|
ht.MineEmptyBlocks(1)
|
||||||
|
|
||||||
commitOutpoint := wire.OutPoint{Hash: closingTxid, Index: 3}
|
commitOutpoint := wire.OutPoint{Hash: closingTxid, Index: 3}
|
||||||
ht.Miner.AssertOutpointInMempool(commitOutpoint)
|
ht.AssertOutpointInMempool(commitOutpoint)
|
||||||
ht.MineBlocksAndAssertNumTxes(1, 1)
|
ht.MineBlocksAndAssertNumTxes(1, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -756,7 +756,7 @@ func runMultiHopLocalForceCloseOnChainHtlcTimeout(ht *lntest.HarnessTest,
|
|||||||
ht.MineEmptyBlocks(1)
|
ht.MineEmptyBlocks(1)
|
||||||
blocksMined++
|
blocksMined++
|
||||||
|
|
||||||
commitSweepTx := ht.Miner.AssertOutpointInMempool(
|
commitSweepTx := ht.AssertOutpointInMempool(
|
||||||
bobCommitOutpoint,
|
bobCommitOutpoint,
|
||||||
)
|
)
|
||||||
txid := commitSweepTx.TxHash()
|
txid := commitSweepTx.TxHash()
|
||||||
@@ -784,7 +784,7 @@ func runMultiHopLocalForceCloseOnChainHtlcTimeout(ht *lntest.HarnessTest,
|
|||||||
|
|
||||||
// We should also now find a transaction in the mempool, as Bob should
|
// We should also now find a transaction in the mempool, as Bob should
|
||||||
// have broadcast his second layer timeout transaction.
|
// have broadcast his second layer timeout transaction.
|
||||||
timeoutTx := ht.Miner.AssertOutpointInMempool(htlcOutpoint).TxHash()
|
timeoutTx := ht.AssertOutpointInMempool(htlcOutpoint).TxHash()
|
||||||
|
|
||||||
// Next, we'll mine an additional block. This should serve to confirm
|
// Next, we'll mine an additional block. This should serve to confirm
|
||||||
// the second layer timeout transaction.
|
// the second layer timeout transaction.
|
||||||
@@ -837,7 +837,7 @@ func runMultiHopLocalForceCloseOnChainHtlcTimeout(ht *lntest.HarnessTest,
|
|||||||
|
|
||||||
// Assert the sweeping tx is found in the mempool.
|
// Assert the sweeping tx is found in the mempool.
|
||||||
htlcTimeoutOutpoint := wire.OutPoint{Hash: timeoutTx, Index: 0}
|
htlcTimeoutOutpoint := wire.OutPoint{Hash: timeoutTx, Index: 0}
|
||||||
ht.Miner.AssertOutpointInMempool(htlcTimeoutOutpoint)
|
ht.AssertOutpointInMempool(htlcTimeoutOutpoint)
|
||||||
|
|
||||||
// Mine a block to confirm the sweep.
|
// Mine a block to confirm the sweep.
|
||||||
ht.MineBlocksAndAssertNumTxes(1, numExpected)
|
ht.MineBlocksAndAssertNumTxes(1, numExpected)
|
||||||
@@ -1042,7 +1042,7 @@ func runMultiHopRemoteForceCloseOnChainHtlcTimeout(ht *lntest.HarnessTest,
|
|||||||
ht.MineEmptyBlocks(1)
|
ht.MineEmptyBlocks(1)
|
||||||
|
|
||||||
bobCommitOutpoint := wire.OutPoint{Hash: *closeTx, Index: 3}
|
bobCommitOutpoint := wire.OutPoint{Hash: *closeTx, Index: 3}
|
||||||
bobCommitSweep := ht.Miner.AssertOutpointInMempool(
|
bobCommitSweep := ht.AssertOutpointInMempool(
|
||||||
bobCommitOutpoint,
|
bobCommitOutpoint,
|
||||||
)
|
)
|
||||||
bobCommitSweepTxid := bobCommitSweep.TxHash()
|
bobCommitSweepTxid := bobCommitSweep.TxHash()
|
||||||
@@ -1219,7 +1219,7 @@ func runMultiHopHtlcLocalChainClaim(ht *lntest.HarnessTest,
|
|||||||
|
|
||||||
// Look up the closing transaction. It should be spending from the
|
// Look up the closing transaction. It should be spending from the
|
||||||
// funding transaction,
|
// funding transaction,
|
||||||
closingTx := ht.Miner.AssertOutpointInMempool(
|
closingTx := ht.AssertOutpointInMempool(
|
||||||
ht.OutPointFromChannelPoint(bobChanPoint),
|
ht.OutPointFromChannelPoint(bobChanPoint),
|
||||||
)
|
)
|
||||||
closingTxid := closingTx.TxHash()
|
closingTxid := closingTx.TxHash()
|
||||||
@@ -1300,7 +1300,7 @@ func runMultiHopHtlcLocalChainClaim(ht *lntest.HarnessTest,
|
|||||||
carolSecondLevelCSV--
|
carolSecondLevelCSV--
|
||||||
|
|
||||||
// Check Bob's second level tx.
|
// Check Bob's second level tx.
|
||||||
bobSecondLvlTx := ht.Miner.GetNumTxsFromMempool(1)[0]
|
bobSecondLvlTx := ht.GetNumTxsFromMempool(1)[0]
|
||||||
|
|
||||||
// It should spend from the commitment in the channel with Alice.
|
// It should spend from the commitment in the channel with Alice.
|
||||||
ht.AssertTxSpendFrom(bobSecondLvlTx, *bobForceClose)
|
ht.AssertTxSpendFrom(bobSecondLvlTx, *bobForceClose)
|
||||||
@@ -1355,7 +1355,7 @@ func runMultiHopHtlcLocalChainClaim(ht *lntest.HarnessTest,
|
|||||||
block = ht.MineBlocksAndAssertNumTxes(bobSecondLevelCSV, 1)[0]
|
block = ht.MineBlocksAndAssertNumTxes(bobSecondLevelCSV, 1)[0]
|
||||||
ht.AssertTxInBlock(block, carolSweep)
|
ht.AssertTxInBlock(block, carolSweep)
|
||||||
|
|
||||||
bobSweep := ht.Miner.GetNumTxsFromMempool(1)[0]
|
bobSweep := ht.GetNumTxsFromMempool(1)[0]
|
||||||
bobSweepTxid := bobSweep.TxHash()
|
bobSweepTxid := bobSweep.TxHash()
|
||||||
|
|
||||||
// When we mine one additional block, that will confirm Bob's sweep.
|
// When we mine one additional block, that will confirm Bob's sweep.
|
||||||
@@ -1399,11 +1399,11 @@ func runMultiHopHtlcLocalChainClaim(ht *lntest.HarnessTest,
|
|||||||
aliceCommitOutpoint := wire.OutPoint{
|
aliceCommitOutpoint := wire.OutPoint{
|
||||||
Hash: *bobForceClose, Index: 3,
|
Hash: *bobForceClose, Index: 3,
|
||||||
}
|
}
|
||||||
ht.Miner.AssertOutpointInMempool(
|
ht.AssertOutpointInMempool(
|
||||||
aliceCommitOutpoint,
|
aliceCommitOutpoint,
|
||||||
).TxHash()
|
).TxHash()
|
||||||
bobCommitOutpoint := wire.OutPoint{Hash: closingTxid, Index: 3}
|
bobCommitOutpoint := wire.OutPoint{Hash: closingTxid, Index: 3}
|
||||||
ht.Miner.AssertOutpointInMempool(
|
ht.AssertOutpointInMempool(
|
||||||
bobCommitOutpoint,
|
bobCommitOutpoint,
|
||||||
).TxHash()
|
).TxHash()
|
||||||
|
|
||||||
@@ -1562,7 +1562,7 @@ func runMultiHopHtlcRemoteChainClaim(ht *lntest.HarnessTest,
|
|||||||
|
|
||||||
// The closing transaction should be spending from the funding
|
// The closing transaction should be spending from the funding
|
||||||
// transaction.
|
// transaction.
|
||||||
closingTx := ht.Miner.AssertOutpointInMempool(
|
closingTx := ht.AssertOutpointInMempool(
|
||||||
ht.OutPointFromChannelPoint(bobChanPoint),
|
ht.OutPointFromChannelPoint(bobChanPoint),
|
||||||
)
|
)
|
||||||
closingTxid := closingTx.TxHash()
|
closingTxid := closingTx.TxHash()
|
||||||
@@ -1624,7 +1624,7 @@ func runMultiHopHtlcRemoteChainClaim(ht *lntest.HarnessTest,
|
|||||||
// NOTE: after Bob is restarted, the sweeping of the direct preimage
|
// NOTE: after Bob is restarted, the sweeping of the direct preimage
|
||||||
// spent will happen immediately so we don't need to mine a block to
|
// spent will happen immediately so we don't need to mine a block to
|
||||||
// trigger Bob's sweeper to sweep it.
|
// trigger Bob's sweeper to sweep it.
|
||||||
bobHtlcSweep := ht.Miner.GetNumTxsFromMempool(1)[0]
|
bobHtlcSweep := ht.GetNumTxsFromMempool(1)[0]
|
||||||
bobHtlcSweepTxid := bobHtlcSweep.TxHash()
|
bobHtlcSweepTxid := bobHtlcSweep.TxHash()
|
||||||
|
|
||||||
// It should spend from the commitment in the channel with Alice.
|
// It should spend from the commitment in the channel with Alice.
|
||||||
@@ -1692,9 +1692,9 @@ func runMultiHopHtlcRemoteChainClaim(ht *lntest.HarnessTest,
|
|||||||
aliceCommitOutpoint := wire.OutPoint{
|
aliceCommitOutpoint := wire.OutPoint{
|
||||||
Hash: *aliceForceClose, Index: 3,
|
Hash: *aliceForceClose, Index: 3,
|
||||||
}
|
}
|
||||||
ht.Miner.AssertOutpointInMempool(aliceCommitOutpoint)
|
ht.AssertOutpointInMempool(aliceCommitOutpoint)
|
||||||
bobCommitOutpoint := wire.OutPoint{Hash: closingTxid, Index: 3}
|
bobCommitOutpoint := wire.OutPoint{Hash: closingTxid, Index: 3}
|
||||||
ht.Miner.AssertOutpointInMempool(bobCommitOutpoint)
|
ht.AssertOutpointInMempool(bobCommitOutpoint)
|
||||||
|
|
||||||
// Confirm their sweeps.
|
// Confirm their sweeps.
|
||||||
ht.MineBlocksAndAssertNumTxes(1, 2)
|
ht.MineBlocksAndAssertNumTxes(1, 2)
|
||||||
@@ -1887,7 +1887,7 @@ func runMultiHopHtlcAggregation(ht *lntest.HarnessTest,
|
|||||||
// other for local.
|
// other for local.
|
||||||
ht.AssertNumPendingSweeps(bob, 2)
|
ht.AssertNumPendingSweeps(bob, 2)
|
||||||
|
|
||||||
closeTx := ht.Miner.AssertOutpointInMempool(
|
closeTx := ht.AssertOutpointInMempool(
|
||||||
ht.OutPointFromChannelPoint(bobChanPoint),
|
ht.OutPointFromChannelPoint(bobChanPoint),
|
||||||
)
|
)
|
||||||
closeTxid := closeTx.TxHash()
|
closeTxid := closeTx.TxHash()
|
||||||
@@ -1977,7 +1977,7 @@ func runMultiHopHtlcAggregation(ht *lntest.HarnessTest,
|
|||||||
ht.MineBlocksAndAssertNumTxes(1, 1)
|
ht.MineBlocksAndAssertNumTxes(1, 1)
|
||||||
|
|
||||||
// Assert the sweeping txns are found in the mempool.
|
// Assert the sweeping txns are found in the mempool.
|
||||||
txes := ht.Miner.GetNumTxsFromMempool(expectedTxes)
|
txes := ht.GetNumTxsFromMempool(expectedTxes)
|
||||||
|
|
||||||
// Since Bob can aggregate the transactions, we expect a single
|
// Since Bob can aggregate the transactions, we expect a single
|
||||||
// transaction, that have multiple spends from the commitment.
|
// transaction, that have multiple spends from the commitment.
|
||||||
@@ -2048,7 +2048,7 @@ func runMultiHopHtlcAggregation(ht *lntest.HarnessTest,
|
|||||||
ht.MineEmptyBlocks(1)
|
ht.MineEmptyBlocks(1)
|
||||||
|
|
||||||
// Find the commitment sweep.
|
// Find the commitment sweep.
|
||||||
bobCommitSweep := ht.Miner.GetNumTxsFromMempool(1)[0]
|
bobCommitSweep := ht.GetNumTxsFromMempool(1)[0]
|
||||||
ht.AssertTxSpendFrom(bobCommitSweep, closeTxid)
|
ht.AssertTxSpendFrom(bobCommitSweep, closeTxid)
|
||||||
|
|
||||||
// Also ensure it is not spending from any of the HTLC output.
|
// Also ensure it is not spending from any of the HTLC output.
|
||||||
@@ -2092,7 +2092,7 @@ func runMultiHopHtlcAggregation(ht *lntest.HarnessTest,
|
|||||||
numBlocks := uint32(forceCloseChan.BlocksTilMaturity)
|
numBlocks := uint32(forceCloseChan.BlocksTilMaturity)
|
||||||
|
|
||||||
// Add debug log.
|
// Add debug log.
|
||||||
_, height := ht.Miner.GetBestBlock()
|
_, height := ht.GetBestBlock()
|
||||||
bob.AddToLogf("itest: now mine %d blocks at height %d",
|
bob.AddToLogf("itest: now mine %d blocks at height %d",
|
||||||
numBlocks, height)
|
numBlocks, height)
|
||||||
ht.MineEmptyBlocks(int(numBlocks) - 1)
|
ht.MineEmptyBlocks(int(numBlocks) - 1)
|
||||||
@@ -2135,7 +2135,7 @@ func runMultiHopHtlcAggregation(ht *lntest.HarnessTest,
|
|||||||
ht.Logf("Checking mempool got: %v", err)
|
ht.Logf("Checking mempool got: %v", err)
|
||||||
|
|
||||||
// Make sure it spends from the second level tx.
|
// Make sure it spends from the second level tx.
|
||||||
secondLevelSweep := ht.Miner.GetNumTxsFromMempool(numExpected)[0]
|
secondLevelSweep := ht.GetNumTxsFromMempool(numExpected)[0]
|
||||||
bobSweep := secondLevelSweep.TxHash()
|
bobSweep := secondLevelSweep.TxHash()
|
||||||
|
|
||||||
// It should be sweeping all the second-level outputs.
|
// It should be sweeping all the second-level outputs.
|
||||||
@@ -2232,7 +2232,7 @@ func createThreeHopNetwork(ht *lntest.HarnessTest,
|
|||||||
var aliceFundingShim *lnrpc.FundingShim
|
var aliceFundingShim *lnrpc.FundingShim
|
||||||
var thawHeight uint32
|
var thawHeight uint32
|
||||||
if c == lnrpc.CommitmentType_SCRIPT_ENFORCED_LEASE {
|
if c == lnrpc.CommitmentType_SCRIPT_ENFORCED_LEASE {
|
||||||
_, minerHeight := ht.Miner.GetBestBlock()
|
_, minerHeight := ht.GetBestBlock()
|
||||||
thawHeight = uint32(minerHeight + thawHeightDelta)
|
thawHeight = uint32(minerHeight + thawHeightDelta)
|
||||||
aliceFundingShim, _ = deriveFundingShim(
|
aliceFundingShim, _ = deriveFundingShim(
|
||||||
ht, alice, bob, chanAmt, thawHeight, true, c,
|
ht, alice, bob, chanAmt, thawHeight, true, c,
|
||||||
@@ -2449,7 +2449,7 @@ func runExtraPreimageFromRemoteCommit(ht *lntest.HarnessTest,
|
|||||||
|
|
||||||
// Get the current height to compute number of blocks to mine to
|
// Get the current height to compute number of blocks to mine to
|
||||||
// trigger the htlc timeout resolver from Bob.
|
// trigger the htlc timeout resolver from Bob.
|
||||||
_, height := ht.Miner.GetBestBlock()
|
_, height := ht.GetBestBlock()
|
||||||
|
|
||||||
// We'll now mine enough blocks to trigger Bob's timeout resolver.
|
// We'll now mine enough blocks to trigger Bob's timeout resolver.
|
||||||
numBlocks = htlc.ExpirationHeight - uint32(height) -
|
numBlocks = htlc.ExpirationHeight - uint32(height) -
|
||||||
@@ -2680,7 +2680,7 @@ func runExtraPreimageFromLocalCommit(ht *lntest.HarnessTest,
|
|||||||
|
|
||||||
// Get the current height to compute number of blocks to mine to
|
// Get the current height to compute number of blocks to mine to
|
||||||
// trigger the timeout resolver from Bob.
|
// trigger the timeout resolver from Bob.
|
||||||
_, height := ht.Miner.GetBestBlock()
|
_, height := ht.GetBestBlock()
|
||||||
|
|
||||||
// We'll now mine enough blocks to trigger Bob's htlc timeout resolver
|
// We'll now mine enough blocks to trigger Bob's htlc timeout resolver
|
||||||
// to act. Once his timeout resolver starts, it will extract the
|
// to act. Once his timeout resolver starts, it will extract the
|
||||||
@@ -2701,7 +2701,7 @@ func runExtraPreimageFromLocalCommit(ht *lntest.HarnessTest,
|
|||||||
// preimage from the blocks.
|
// preimage from the blocks.
|
||||||
if ht.IsNeutrinoBackend() {
|
if ht.IsNeutrinoBackend() {
|
||||||
// Make sure the direct spend tx is still in the mempool.
|
// Make sure the direct spend tx is still in the mempool.
|
||||||
ht.Miner.AssertOutpointInMempool(htlcOutpoint)
|
ht.AssertOutpointInMempool(htlcOutpoint)
|
||||||
|
|
||||||
// Mine a block to confirm Carol's direct spend tx.
|
// Mine a block to confirm Carol's direct spend tx.
|
||||||
ht.MineBlocks(1)
|
ht.MineBlocks(1)
|
||||||
|
|||||||
@@ -486,7 +486,7 @@ func testAnchorThirdPartySpend(ht *lntest.HarnessTest) {
|
|||||||
|
|
||||||
// We now update the anchor sweep's deadline to be different than the
|
// We now update the anchor sweep's deadline to be different than the
|
||||||
// commit sweep so they can won't grouped together.
|
// commit sweep so they can won't grouped together.
|
||||||
_, currentHeight := ht.Miner.GetBestBlock()
|
_, currentHeight := ht.GetBestBlock()
|
||||||
deadline := int32(commit.DeadlineHeight) - currentHeight
|
deadline := int32(commit.DeadlineHeight) - currentHeight
|
||||||
require.Positive(ht, deadline)
|
require.Positive(ht, deadline)
|
||||||
ht.Logf("Found commit deadline %d, anchor deadline %d",
|
ht.Logf("Found commit deadline %d, anchor deadline %d",
|
||||||
@@ -520,7 +520,7 @@ func testAnchorThirdPartySpend(ht *lntest.HarnessTest) {
|
|||||||
// Mine one block to trigger Alice's sweeper to reconsider the anchor
|
// Mine one block to trigger Alice's sweeper to reconsider the anchor
|
||||||
// sweeping - it will be swept with her commit output together in one
|
// sweeping - it will be swept with her commit output together in one
|
||||||
// tx.
|
// tx.
|
||||||
txns := ht.Miner.GetNumTxsFromMempool(2)
|
txns := ht.GetNumTxsFromMempool(2)
|
||||||
aliceSweep := txns[0]
|
aliceSweep := txns[0]
|
||||||
if aliceSweep.TxOut[0].Value > txns[1].TxOut[0].Value {
|
if aliceSweep.TxOut[0].Value > txns[1].TxOut[0].Value {
|
||||||
aliceSweep = txns[1]
|
aliceSweep = txns[1]
|
||||||
@@ -600,7 +600,7 @@ func testAnchorThirdPartySpend(ht *lntest.HarnessTest) {
|
|||||||
Hash: *forceCloseTxID,
|
Hash: *forceCloseTxID,
|
||||||
Index: 1,
|
Index: 1,
|
||||||
}
|
}
|
||||||
ht.Miner.AssertOutpointInMempool(commitSweepOp)
|
ht.AssertOutpointInMempool(commitSweepOp)
|
||||||
ht.MineBlocks(1)
|
ht.MineBlocks(1)
|
||||||
|
|
||||||
ht.AssertNumWaitingClose(alice, 0)
|
ht.AssertNumWaitingClose(alice, 0)
|
||||||
@@ -727,7 +727,7 @@ func testRemoveTx(ht *lntest.HarnessTest) {
|
|||||||
require.Lenf(ht, unconfirmed, 2, "number of unconfirmed tx")
|
require.Lenf(ht, unconfirmed, 2, "number of unconfirmed tx")
|
||||||
|
|
||||||
// Get the raw transaction to calculate the exact fee.
|
// Get the raw transaction to calculate the exact fee.
|
||||||
tx := ht.Miner.GetNumTxsFromMempool(1)[0]
|
tx := ht.GetNumTxsFromMempool(1)[0]
|
||||||
|
|
||||||
// Calculate the tx fee so we can compare the end amounts. We are
|
// Calculate the tx fee so we can compare the end amounts. We are
|
||||||
// sending from the internal wallet to the internal wallet so only
|
// sending from the internal wallet to the internal wallet so only
|
||||||
@@ -836,7 +836,7 @@ func testListSweeps(ht *lntest.HarnessTest) {
|
|||||||
ht.MineEmptyBlocks(1)
|
ht.MineEmptyBlocks(1)
|
||||||
|
|
||||||
// Get the current block height.
|
// Get the current block height.
|
||||||
_, blockHeight := ht.Miner.GetBestBlock()
|
_, blockHeight := ht.GetBestBlock()
|
||||||
|
|
||||||
// Close the second channel and also sweep the funds.
|
// Close the second channel and also sweep the funds.
|
||||||
ht.ForceCloseChannel(alice, chanPoints[1])
|
ht.ForceCloseChannel(alice, chanPoints[1])
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ func testRestAPI(ht *lntest.HarnessTest) {
|
|||||||
|
|
||||||
func wsTestCaseSubscription(ht *lntest.HarnessTest) {
|
func wsTestCaseSubscription(ht *lntest.HarnessTest) {
|
||||||
// Find out the current best block so we can subscribe to the next one.
|
// Find out the current best block so we can subscribe to the next one.
|
||||||
hash, height := ht.Miner.GetBestBlock()
|
hash, height := ht.GetBestBlock()
|
||||||
|
|
||||||
// Create a new subscription to get block epoch events.
|
// Create a new subscription to get block epoch events.
|
||||||
req := &chainrpc.BlockEpoch{
|
req := &chainrpc.BlockEpoch{
|
||||||
@@ -314,7 +314,7 @@ func wsTestCaseSubscription(ht *lntest.HarnessTest) {
|
|||||||
|
|
||||||
func wsTestCaseSubscriptionMacaroon(ht *lntest.HarnessTest) {
|
func wsTestCaseSubscriptionMacaroon(ht *lntest.HarnessTest) {
|
||||||
// Find out the current best block so we can subscribe to the next one.
|
// Find out the current best block so we can subscribe to the next one.
|
||||||
hash, height := ht.Miner.GetBestBlock()
|
hash, height := ht.GetBestBlock()
|
||||||
|
|
||||||
// Create a new subscription to get block epoch events.
|
// Create a new subscription to get block epoch events.
|
||||||
req := &chainrpc.BlockEpoch{
|
req := &chainrpc.BlockEpoch{
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ func breachRetributionTestCase(ht *lntest.HarnessTest,
|
|||||||
// sweeping transactions in the mempool. Thus we directly assert that
|
// sweeping transactions in the mempool. Thus we directly assert that
|
||||||
// the breach transaction's outpoint is seen in the mempool instead of
|
// the breach transaction's outpoint is seen in the mempool instead of
|
||||||
// checking the number of transactions.
|
// checking the number of transactions.
|
||||||
justiceTx := ht.Miner.AssertOutpointInMempool(toRemoteOp)
|
justiceTx := ht.AssertOutpointInMempool(toRemoteOp)
|
||||||
|
|
||||||
// Assert that all the inputs of this transaction are spending outputs
|
// Assert that all the inputs of this transaction are spending outputs
|
||||||
// generated by Bob's breach transaction above.
|
// generated by Bob's breach transaction above.
|
||||||
@@ -338,7 +338,7 @@ func revokedCloseRetributionZeroValueRemoteOutputCase(ht *lntest.HarnessTest,
|
|||||||
// sweeping transactions in the mempool. Thus we directly assert that
|
// sweeping transactions in the mempool. Thus we directly assert that
|
||||||
// the breach transaction's outpoint is seen in the mempool instead of
|
// the breach transaction's outpoint is seen in the mempool instead of
|
||||||
// checking the number of transactions.
|
// checking the number of transactions.
|
||||||
justiceTx := ht.Miner.AssertOutpointInMempool(toLocalOp)
|
justiceTx := ht.AssertOutpointInMempool(toLocalOp)
|
||||||
|
|
||||||
// Assert that all the inputs of this transaction are spending outputs
|
// Assert that all the inputs of this transaction are spending outputs
|
||||||
// generated by Carol's breach transaction above.
|
// generated by Carol's breach transaction above.
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ func testSingleHopSendToRouteCase(ht *lntest.HarnessTest,
|
|||||||
// Assert Carol and Dave are synced to the chain before proceeding, to
|
// Assert Carol and Dave are synced to the chain before proceeding, to
|
||||||
// ensure the queried route will have a valid final CLTV once the HTLC
|
// ensure the queried route will have a valid final CLTV once the HTLC
|
||||||
// reaches Dave.
|
// reaches Dave.
|
||||||
_, minerHeight := ht.Miner.GetBestBlock()
|
_, minerHeight := ht.GetBestBlock()
|
||||||
ht.WaitForNodeBlockHeight(carol, minerHeight)
|
ht.WaitForNodeBlockHeight(carol, minerHeight)
|
||||||
ht.WaitForNodeBlockHeight(dave, minerHeight)
|
ht.WaitForNodeBlockHeight(dave, minerHeight)
|
||||||
|
|
||||||
|
|||||||
+27
-27
@@ -209,7 +209,7 @@ func testSweepCPFPAnchorOutgoingTimeout(ht *lntest.HarnessTest) {
|
|||||||
//
|
//
|
||||||
// We should see Bob's anchor sweeping tx triggered by the above
|
// We should see Bob's anchor sweeping tx triggered by the above
|
||||||
// block, along with his force close tx.
|
// block, along with his force close tx.
|
||||||
txns := ht.Miner.GetNumTxsFromMempool(2)
|
txns := ht.GetNumTxsFromMempool(2)
|
||||||
|
|
||||||
// Find the sweeping tx.
|
// Find the sweeping tx.
|
||||||
sweepTx := ht.FindSweepingTxns(txns, 1, *closeTxid)[0]
|
sweepTx := ht.FindSweepingTxns(txns, 1, *closeTxid)[0]
|
||||||
@@ -261,7 +261,7 @@ func testSweepCPFPAnchorOutgoingTimeout(ht *lntest.HarnessTest) {
|
|||||||
|
|
||||||
// Make sure Bob's old sweeping tx has been removed from the
|
// Make sure Bob's old sweeping tx has been removed from the
|
||||||
// mempool.
|
// mempool.
|
||||||
ht.Miner.AssertTxNotInMempool(sweepTx.TxHash())
|
ht.AssertTxNotInMempool(sweepTx.TxHash())
|
||||||
|
|
||||||
// We expect to see two txns in the mempool,
|
// We expect to see two txns in the mempool,
|
||||||
// - Bob's force close tx.
|
// - Bob's force close tx.
|
||||||
@@ -276,7 +276,7 @@ func testSweepCPFPAnchorOutgoingTimeout(ht *lntest.HarnessTest) {
|
|||||||
|
|
||||||
// We should see Bob's anchor sweeping tx being fee bumped
|
// We should see Bob's anchor sweeping tx being fee bumped
|
||||||
// since it's not confirmed, along with his force close tx.
|
// since it's not confirmed, along with his force close tx.
|
||||||
txns = ht.Miner.GetNumTxsFromMempool(2)
|
txns = ht.GetNumTxsFromMempool(2)
|
||||||
|
|
||||||
// Find the sweeping tx.
|
// Find the sweeping tx.
|
||||||
sweepTx = ht.FindSweepingTxns(txns, 1, *closeTxid)[0]
|
sweepTx = ht.FindSweepingTxns(txns, 1, *closeTxid)[0]
|
||||||
@@ -311,11 +311,11 @@ func testSweepCPFPAnchorOutgoingTimeout(ht *lntest.HarnessTest) {
|
|||||||
ht.MineEmptyBlocks(1)
|
ht.MineEmptyBlocks(1)
|
||||||
|
|
||||||
// Make sure Bob's old sweeping tx has been removed from the mempool.
|
// Make sure Bob's old sweeping tx has been removed from the mempool.
|
||||||
ht.Miner.AssertTxNotInMempool(sweepTx.TxHash())
|
ht.AssertTxNotInMempool(sweepTx.TxHash())
|
||||||
|
|
||||||
// Get the last sweeping tx - we should see two txns here, Bob's anchor
|
// Get the last sweeping tx - we should see two txns here, Bob's anchor
|
||||||
// sweeping tx and his force close tx.
|
// sweeping tx and his force close tx.
|
||||||
txns = ht.Miner.GetNumTxsFromMempool(2)
|
txns = ht.GetNumTxsFromMempool(2)
|
||||||
|
|
||||||
// Find the sweeping tx.
|
// Find the sweeping tx.
|
||||||
sweepTx = ht.FindSweepingTxns(txns, 1, *closeTxid)[0]
|
sweepTx = ht.FindSweepingTxns(txns, 1, *closeTxid)[0]
|
||||||
@@ -336,7 +336,7 @@ func testSweepCPFPAnchorOutgoingTimeout(ht *lntest.HarnessTest) {
|
|||||||
//
|
//
|
||||||
// We expect two txns here, one for the anchor sweeping, the other for
|
// We expect two txns here, one for the anchor sweeping, the other for
|
||||||
// the force close tx.
|
// the force close tx.
|
||||||
txns = ht.Miner.GetNumTxsFromMempool(2)
|
txns = ht.GetNumTxsFromMempool(2)
|
||||||
|
|
||||||
// Find the sweeping tx.
|
// Find the sweeping tx.
|
||||||
currentSweepTx := ht.FindSweepingTxns(txns, 1, *closeTxid)[0]
|
currentSweepTx := ht.FindSweepingTxns(txns, 1, *closeTxid)[0]
|
||||||
@@ -912,7 +912,7 @@ func testSweepHTLCs(ht *lntest.HarnessTest) {
|
|||||||
|
|
||||||
// Bob should now have one sweep and one sweeping tx in the mempool.
|
// Bob should now have one sweep and one sweeping tx in the mempool.
|
||||||
ht.AssertNumPendingSweeps(bob, 1)
|
ht.AssertNumPendingSweeps(bob, 1)
|
||||||
outgoingSweep := ht.Miner.GetNumTxsFromMempool(1)[0]
|
outgoingSweep := ht.GetNumTxsFromMempool(1)[0]
|
||||||
|
|
||||||
// Check the shape of the sweeping tx - we expect it to be
|
// Check the shape of the sweeping tx - we expect it to be
|
||||||
// 2-input-2-output as a wallet utxo is used and a required output is
|
// 2-input-2-output as a wallet utxo is used and a required output is
|
||||||
@@ -986,13 +986,13 @@ func testSweepHTLCs(ht *lntest.HarnessTest) {
|
|||||||
|
|
||||||
// Make sure Bob's old sweeping tx has been removed from the
|
// Make sure Bob's old sweeping tx has been removed from the
|
||||||
// mempool.
|
// mempool.
|
||||||
ht.Miner.AssertTxNotInMempool(outgoingSweep.TxHash())
|
ht.AssertTxNotInMempool(outgoingSweep.TxHash())
|
||||||
|
|
||||||
// Bob should still have the outgoing HTLC sweep.
|
// Bob should still have the outgoing HTLC sweep.
|
||||||
ht.AssertNumPendingSweeps(bob, 1)
|
ht.AssertNumPendingSweeps(bob, 1)
|
||||||
|
|
||||||
// We should see Bob's replacement tx in the mempool.
|
// We should see Bob's replacement tx in the mempool.
|
||||||
outgoingSweep = ht.Miner.GetNumTxsFromMempool(1)[0]
|
outgoingSweep = ht.GetNumTxsFromMempool(1)[0]
|
||||||
|
|
||||||
// Bob's outgoing HTLC sweeping tx should be fee bumped.
|
// Bob's outgoing HTLC sweeping tx should be fee bumped.
|
||||||
assertSweepFeeRate(
|
assertSweepFeeRate(
|
||||||
@@ -1018,7 +1018,7 @@ func testSweepHTLCs(ht *lntest.HarnessTest) {
|
|||||||
// We should see two txns in the mempool:
|
// We should see two txns in the mempool:
|
||||||
// 1. Bob's outgoing HTLC sweeping tx.
|
// 1. Bob's outgoing HTLC sweeping tx.
|
||||||
// 2. Bob's force close tx for Alice->Bob.
|
// 2. Bob's force close tx for Alice->Bob.
|
||||||
txns := ht.Miner.GetNumTxsFromMempool(2)
|
txns := ht.GetNumTxsFromMempool(2)
|
||||||
|
|
||||||
// Find the force close tx - we expect it to have a single input.
|
// Find the force close tx - we expect it to have a single input.
|
||||||
closeTx := txns[0]
|
closeTx := txns[0]
|
||||||
@@ -1051,7 +1051,7 @@ func testSweepHTLCs(ht *lntest.HarnessTest) {
|
|||||||
// 1. the outgoing HTLC sweeping tx.
|
// 1. the outgoing HTLC sweeping tx.
|
||||||
// 2. the incoming HTLC sweeping tx.
|
// 2. the incoming HTLC sweeping tx.
|
||||||
// 3. the anchor sweeping tx.
|
// 3. the anchor sweeping tx.
|
||||||
txns = ht.Miner.GetNumTxsFromMempool(3)
|
txns = ht.GetNumTxsFromMempool(3)
|
||||||
|
|
||||||
abCloseTxid := closeTx.TxHash()
|
abCloseTxid := closeTx.TxHash()
|
||||||
|
|
||||||
@@ -1102,7 +1102,7 @@ func testSweepHTLCs(ht *lntest.HarnessTest) {
|
|||||||
// We should see two txns in the mempool:
|
// We should see two txns in the mempool:
|
||||||
// 1. the outgoing HTLC sweeping tx.
|
// 1. the outgoing HTLC sweeping tx.
|
||||||
// 2. the incoming HTLC sweeping tx.
|
// 2. the incoming HTLC sweeping tx.
|
||||||
txns = ht.Miner.GetNumTxsFromMempool(2)
|
txns = ht.GetNumTxsFromMempool(2)
|
||||||
|
|
||||||
var incoming, outgoing *wire.MsgTx
|
var incoming, outgoing *wire.MsgTx
|
||||||
|
|
||||||
@@ -1160,8 +1160,8 @@ func testSweepHTLCs(ht *lntest.HarnessTest) {
|
|||||||
|
|
||||||
// Make sure Bob's old sweeping txns have been removed from the
|
// Make sure Bob's old sweeping txns have been removed from the
|
||||||
// mempool.
|
// mempool.
|
||||||
ht.Miner.AssertTxNotInMempool(outgoingSweep.TxHash())
|
ht.AssertTxNotInMempool(outgoingSweep.TxHash())
|
||||||
ht.Miner.AssertTxNotInMempool(incomingSweep.TxHash())
|
ht.AssertTxNotInMempool(incomingSweep.TxHash())
|
||||||
|
|
||||||
// Bob should have two pending sweeps:
|
// Bob should have two pending sweeps:
|
||||||
// 1. the outgoing HTLC output on Bob->Carol.
|
// 1. the outgoing HTLC output on Bob->Carol.
|
||||||
@@ -1370,7 +1370,7 @@ func testSweepCommitOutputAndAnchor(ht *lntest.HarnessTest) {
|
|||||||
// - Alice's anchor sweeping tx must have been failed due to the fee
|
// - Alice's anchor sweeping tx must have been failed due to the fee
|
||||||
// rate chosen in this test - the anchor sweep tx has no output.
|
// rate chosen in this test - the anchor sweep tx has no output.
|
||||||
// - Bob's sweeping tx, which sweeps both his anchor and commit outputs.
|
// - Bob's sweeping tx, which sweeps both his anchor and commit outputs.
|
||||||
bobSweepTx := ht.Miner.GetNumTxsFromMempool(1)[0]
|
bobSweepTx := ht.GetNumTxsFromMempool(1)[0]
|
||||||
|
|
||||||
// We expect two pending sweeps for Bob - anchor and commit outputs.
|
// We expect two pending sweeps for Bob - anchor and commit outputs.
|
||||||
pendingSweepBob := ht.AssertNumPendingSweeps(bob, 2)[0]
|
pendingSweepBob := ht.AssertNumPendingSweeps(bob, 2)[0]
|
||||||
@@ -1466,7 +1466,7 @@ func testSweepCommitOutputAndAnchor(ht *lntest.HarnessTest) {
|
|||||||
// created and published.
|
// created and published.
|
||||||
aliceStartPosition = 1
|
aliceStartPosition = 1
|
||||||
|
|
||||||
txns := ht.Miner.GetNumTxsFromMempool(2)
|
txns := ht.GetNumTxsFromMempool(2)
|
||||||
aliceFirstSweepTx = txns[0]
|
aliceFirstSweepTx = txns[0]
|
||||||
|
|
||||||
// Reassign if the second tx is larger.
|
// Reassign if the second tx is larger.
|
||||||
@@ -1503,7 +1503,7 @@ func testSweepCommitOutputAndAnchor(ht *lntest.HarnessTest) {
|
|||||||
// commit output together because they have different deadlines.
|
// commit output together because they have different deadlines.
|
||||||
// - Bob's previous sweeping tx, which sweeps both his anchor and
|
// - Bob's previous sweeping tx, which sweeps both his anchor and
|
||||||
// commit outputs, at the starting fee rate.
|
// commit outputs, at the starting fee rate.
|
||||||
txns := ht.Miner.GetNumTxsFromMempool(2)
|
txns := ht.GetNumTxsFromMempool(2)
|
||||||
|
|
||||||
// Assume the first tx is Alice's sweeping tx, if the second tx has a
|
// Assume the first tx is Alice's sweeping tx, if the second tx has a
|
||||||
// larger output value, then that's Alice's as her to_local value is
|
// larger output value, then that's Alice's as her to_local value is
|
||||||
@@ -1611,7 +1611,7 @@ func testSweepCommitOutputAndAnchor(ht *lntest.HarnessTest) {
|
|||||||
// commit outputs, using the increased fee rate.
|
// commit outputs, using the increased fee rate.
|
||||||
// - Bob's previous sweeping tx, which sweeps both his anchor
|
// - Bob's previous sweeping tx, which sweeps both his anchor
|
||||||
// and commit outputs, at the possible increased fee rate.
|
// and commit outputs, at the possible increased fee rate.
|
||||||
txns = ht.Miner.GetNumTxsFromMempool(2)
|
txns = ht.GetNumTxsFromMempool(2)
|
||||||
|
|
||||||
// Assume the first tx is Alice's sweeping tx, if the second tx
|
// Assume the first tx is Alice's sweeping tx, if the second tx
|
||||||
// has a larger output value, then that's Alice's as her
|
// has a larger output value, then that's Alice's as her
|
||||||
@@ -1691,14 +1691,14 @@ func testSweepCommitOutputAndAnchor(ht *lntest.HarnessTest) {
|
|||||||
|
|
||||||
// Make sure Alice's old sweeping tx has been removed from the
|
// Make sure Alice's old sweeping tx has been removed from the
|
||||||
// mempool.
|
// mempool.
|
||||||
ht.Miner.AssertTxNotInMempool(aliceSweepTx.TxHash())
|
ht.AssertTxNotInMempool(aliceSweepTx.TxHash())
|
||||||
|
|
||||||
// Make sure Bob's old sweeping tx has been removed from the
|
// Make sure Bob's old sweeping tx has been removed from the
|
||||||
// mempool. Since Bob's sweeping tx will only be successfully
|
// mempool. Since Bob's sweeping tx will only be successfully
|
||||||
// RBFed every 4 blocks, his old sweeping tx only will be
|
// RBFed every 4 blocks, his old sweeping tx only will be
|
||||||
// removed when there are 4 blocks increased.
|
// removed when there are 4 blocks increased.
|
||||||
if bobPosition%4 == 0 {
|
if bobPosition%4 == 0 {
|
||||||
ht.Miner.AssertTxNotInMempool(bobSweepTx.TxHash())
|
ht.AssertTxNotInMempool(bobSweepTx.TxHash())
|
||||||
}
|
}
|
||||||
|
|
||||||
// We should see two txns in the mempool:
|
// We should see two txns in the mempool:
|
||||||
@@ -1706,7 +1706,7 @@ func testSweepCommitOutputAndAnchor(ht *lntest.HarnessTest) {
|
|||||||
// commit outputs, using the increased fee rate.
|
// commit outputs, using the increased fee rate.
|
||||||
// - Bob's previous sweeping tx, which sweeps both his anchor
|
// - Bob's previous sweeping tx, which sweeps both his anchor
|
||||||
// and commit outputs, at the possible increased fee rate.
|
// and commit outputs, at the possible increased fee rate.
|
||||||
txns := ht.Miner.GetNumTxsFromMempool(2)
|
txns := ht.GetNumTxsFromMempool(2)
|
||||||
|
|
||||||
// Assume the first tx is Alice's sweeping tx, if the second tx
|
// Assume the first tx is Alice's sweeping tx, if the second tx
|
||||||
// has a larger output value, then that's Alice's as her
|
// has a larger output value, then that's Alice's as her
|
||||||
@@ -1911,7 +1911,7 @@ func runBumpFee(ht *lntest.HarnessTest, alice *node.HarnessNode) {
|
|||||||
|
|
||||||
// We expect to see Alice's original tx and her CPFP tx in the
|
// We expect to see Alice's original tx and her CPFP tx in the
|
||||||
// mempool.
|
// mempool.
|
||||||
txns := ht.Miner.GetNumTxsFromMempool(2)
|
txns := ht.GetNumTxsFromMempool(2)
|
||||||
|
|
||||||
// Find the sweeping tx - assume it's the first item, if it has
|
// Find the sweeping tx - assume it's the first item, if it has
|
||||||
// the same txid as the parent tx, use the second item.
|
// the same txid as the parent tx, use the second item.
|
||||||
@@ -1972,7 +1972,7 @@ func runBumpFee(ht *lntest.HarnessTest, alice *node.HarnessNode) {
|
|||||||
|
|
||||||
// Since the request doesn't specify a deadline, we expect the default
|
// Since the request doesn't specify a deadline, we expect the default
|
||||||
// deadline to be used.
|
// deadline to be used.
|
||||||
_, currentHeight := ht.Miner.GetBestBlock()
|
_, currentHeight := ht.GetBestBlock()
|
||||||
deadline := uint32(currentHeight + sweep.DefaultDeadlineDelta)
|
deadline := uint32(currentHeight + sweep.DefaultDeadlineDelta)
|
||||||
|
|
||||||
// Assert the pending sweep is created with the expected values:
|
// Assert the pending sweep is created with the expected values:
|
||||||
@@ -2003,7 +2003,7 @@ func runBumpFee(ht *lntest.HarnessTest, alice *node.HarnessNode) {
|
|||||||
alice.RPC.BumpFee(bumpFeeReq)
|
alice.RPC.BumpFee(bumpFeeReq)
|
||||||
|
|
||||||
// Alice's old sweeping tx should be replaced.
|
// Alice's old sweeping tx should be replaced.
|
||||||
ht.Miner.AssertTxNotInMempool(sweepTx1.TxHash())
|
ht.AssertTxNotInMempool(sweepTx1.TxHash())
|
||||||
|
|
||||||
// Assert the pending sweep is created with the expected values:
|
// Assert the pending sweep is created with the expected values:
|
||||||
// - broadcast attempts: 2.
|
// - broadcast attempts: 2.
|
||||||
@@ -2035,7 +2035,7 @@ func runBumpFee(ht *lntest.HarnessTest, alice *node.HarnessNode) {
|
|||||||
alice.RPC.BumpFee(bumpFeeReq)
|
alice.RPC.BumpFee(bumpFeeReq)
|
||||||
|
|
||||||
// Alice's old sweeping tx should be replaced.
|
// Alice's old sweeping tx should be replaced.
|
||||||
ht.Miner.AssertTxNotInMempool(sweepTx2.TxHash())
|
ht.AssertTxNotInMempool(sweepTx2.TxHash())
|
||||||
|
|
||||||
// Assert the pending sweep is created with the expected values:
|
// Assert the pending sweep is created with the expected values:
|
||||||
// - broadcast attempts: 3.
|
// - broadcast attempts: 3.
|
||||||
@@ -2066,7 +2066,7 @@ func runBumpFee(ht *lntest.HarnessTest, alice *node.HarnessNode) {
|
|||||||
alice.RPC.BumpFee(bumpFeeReq)
|
alice.RPC.BumpFee(bumpFeeReq)
|
||||||
|
|
||||||
// Alice's old sweeping tx should be replaced.
|
// Alice's old sweeping tx should be replaced.
|
||||||
ht.Miner.AssertTxNotInMempool(sweepTx3.TxHash())
|
ht.AssertTxNotInMempool(sweepTx3.TxHash())
|
||||||
|
|
||||||
// Assert the pending sweep is created with the expected values:
|
// Assert the pending sweep is created with the expected values:
|
||||||
// - broadcast attempts: 4.
|
// - broadcast attempts: 4.
|
||||||
@@ -2093,7 +2093,7 @@ func runBumpFee(ht *lntest.HarnessTest, alice *node.HarnessNode) {
|
|||||||
alice.RPC.BumpFee(bumpFeeReq)
|
alice.RPC.BumpFee(bumpFeeReq)
|
||||||
|
|
||||||
// Alice's old sweeping tx should be replaced.
|
// Alice's old sweeping tx should be replaced.
|
||||||
ht.Miner.AssertTxNotInMempool(sweepTx4.TxHash())
|
ht.AssertTxNotInMempool(sweepTx4.TxHash())
|
||||||
|
|
||||||
// Assert the pending sweep is created with the expected values:
|
// Assert the pending sweep is created with the expected values:
|
||||||
// - broadcast attempts: 5.
|
// - broadcast attempts: 5.
|
||||||
|
|||||||
@@ -1535,7 +1535,7 @@ func publishTxAndConfirmSweep(ht *lntest.HarnessTest, node *node.HarnessNode,
|
|||||||
// Before we publish the tx that spends the p2tr transaction, we want to
|
// Before we publish the tx that spends the p2tr transaction, we want to
|
||||||
// register a spend listener that we expect to fire after mining the
|
// register a spend listener that we expect to fire after mining the
|
||||||
// block.
|
// block.
|
||||||
_, currentHeight := ht.Miner.GetBestBlock()
|
_, currentHeight := ht.GetBestBlock()
|
||||||
|
|
||||||
// For a Taproot output we cannot leave the outpoint empty. Let's make
|
// For a Taproot output we cannot leave the outpoint empty. Let's make
|
||||||
// sure the API returns the correct error here.
|
// sure the API returns the correct error here.
|
||||||
@@ -1609,7 +1609,7 @@ func confirmAddress(ht *lntest.HarnessTest, hn *node.HarnessNode,
|
|||||||
addrPkScript, err := txscript.PayToAddrScript(parsedAddr)
|
addrPkScript, err := txscript.PayToAddrScript(parsedAddr)
|
||||||
require.NoError(ht, err)
|
require.NoError(ht, err)
|
||||||
|
|
||||||
_, currentHeight := ht.Miner.GetBestBlock()
|
_, currentHeight := ht.GetBestBlock()
|
||||||
req := &chainrpc.ConfRequest{
|
req := &chainrpc.ConfRequest{
|
||||||
Script: addrPkScript,
|
Script: addrPkScript,
|
||||||
Txid: txid[:],
|
Txid: txid[:],
|
||||||
|
|||||||
+1
-1
@@ -151,7 +151,7 @@ func TestLightningNetworkDaemon(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_, height := harnessTest.Miner.GetBestBlock()
|
_, height := harnessTest.GetBestBlock()
|
||||||
t.Logf("=========> tests finished for tranche: %v, tested %d "+
|
t.Logf("=========> tests finished for tranche: %v, tested %d "+
|
||||||
"cases, end height: %d\n", trancheIndex, len(testCases), height)
|
"cases, end height: %d\n", trancheIndex, len(testCases), height)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -962,7 +962,7 @@ func testZeroConfReorg(ht *lntest.HarnessTest) {
|
|||||||
ht.Miner.AssertMinerBlockHeightDelta(tempMiner, 1)
|
ht.Miner.AssertMinerBlockHeightDelta(tempMiner, 1)
|
||||||
|
|
||||||
// Wait for Carol to sync to the original miner's chain.
|
// Wait for Carol to sync to the original miner's chain.
|
||||||
_, minerHeight := ht.Miner.GetBestBlock()
|
_, minerHeight := ht.GetBestBlock()
|
||||||
ht.WaitForNodeBlockHeight(carol, minerHeight)
|
ht.WaitForNodeBlockHeight(carol, minerHeight)
|
||||||
|
|
||||||
// Now we'll disconnect Carol's chain backend from the original miner
|
// Now we'll disconnect Carol's chain backend from the original miner
|
||||||
|
|||||||
+3
-3
@@ -433,10 +433,10 @@ func (h *HarnessTest) Subtest(t *testing.T) *HarnessTest {
|
|||||||
st.feeService.Reset()
|
st.feeService.Reset()
|
||||||
|
|
||||||
// Record block height.
|
// Record block height.
|
||||||
_, startHeight := h.Miner.GetBestBlock()
|
_, startHeight := h.GetBestBlock()
|
||||||
|
|
||||||
st.Cleanup(func() {
|
st.Cleanup(func() {
|
||||||
_, endHeight := h.Miner.GetBestBlock()
|
_, endHeight := h.GetBestBlock()
|
||||||
|
|
||||||
st.Logf("finished test: %s, start height=%d, end height=%d, "+
|
st.Logf("finished test: %s, start height=%d, end height=%d, "+
|
||||||
"mined blocks=%d", st.manager.currentTestCase,
|
"mined blocks=%d", st.manager.currentTestCase,
|
||||||
@@ -2158,7 +2158,7 @@ func (h *HarnessTest) SendCoins(a, b *node.HarnessNode,
|
|||||||
TargetConf: 6,
|
TargetConf: 6,
|
||||||
}
|
}
|
||||||
a.RPC.SendCoins(sendReq)
|
a.RPC.SendCoins(sendReq)
|
||||||
tx := h.Miner.GetNumTxsFromMempool(1)[0]
|
tx := h.GetNumTxsFromMempool(1)[0]
|
||||||
|
|
||||||
return tx
|
return tx
|
||||||
}
|
}
|
||||||
@@ -2568,7 +2568,7 @@ func (h *HarnessTest) AssertClosingTxInMempool(cp *lnrpc.ChannelPoint,
|
|||||||
|
|
||||||
// Get the closing tx from the mempool.
|
// Get the closing tx from the mempool.
|
||||||
op := h.OutPointFromChannelPoint(cp)
|
op := h.OutPointFromChannelPoint(cp)
|
||||||
closeTx := h.Miner.AssertOutpointInMempool(op)
|
closeTx := h.AssertOutpointInMempool(op)
|
||||||
|
|
||||||
return closeTx
|
return closeTx
|
||||||
}
|
}
|
||||||
@@ -2582,7 +2582,7 @@ func (h *HarnessTest) MineClosingTx(cp *lnrpc.ChannelPoint) *wire.MsgTx {
|
|||||||
|
|
||||||
// Get the closing tx from the mempool.
|
// Get the closing tx from the mempool.
|
||||||
op := h.OutPointFromChannelPoint(cp)
|
op := h.OutPointFromChannelPoint(cp)
|
||||||
closeTx := h.Miner.AssertOutpointInMempool(op)
|
closeTx := h.AssertOutpointInMempool(op)
|
||||||
|
|
||||||
// Mine a block to confirm the closing transaction and potential anchor
|
// Mine a block to confirm the closing transaction and potential anchor
|
||||||
// sweep.
|
// sweep.
|
||||||
|
|||||||
+36
-5
@@ -80,7 +80,7 @@ func (h *HarnessTest) MineBlocksAndAssertNumTxes(num uint32,
|
|||||||
|
|
||||||
// If we expect transactions to be included in the blocks we'll mine,
|
// If we expect transactions to be included in the blocks we'll mine,
|
||||||
// we wait here until they are seen in the miner's mempool.
|
// we wait here until they are seen in the miner's mempool.
|
||||||
txids := h.Miner.AssertNumTxsInMempool(numTxs)
|
txids := h.AssertNumTxsInMempool(numTxs)
|
||||||
|
|
||||||
// Mine blocks.
|
// Mine blocks.
|
||||||
blocks := h.Miner.MineBlocksSlow(num)
|
blocks := h.Miner.MineBlocksSlow(num)
|
||||||
@@ -118,7 +118,7 @@ func (h *HarnessTest) DisconnectMiner() {
|
|||||||
// cleanMempool mines blocks till the mempool is empty and asserts all active
|
// cleanMempool mines blocks till the mempool is empty and asserts all active
|
||||||
// nodes have synced to the chain.
|
// nodes have synced to the chain.
|
||||||
func (h *HarnessTest) cleanMempool() {
|
func (h *HarnessTest) cleanMempool() {
|
||||||
_, startHeight := h.Miner.GetBestBlock()
|
_, startHeight := h.GetBestBlock()
|
||||||
|
|
||||||
// Mining the blocks slow to give `lnd` more time to sync.
|
// Mining the blocks slow to give `lnd` more time to sync.
|
||||||
var bestBlock *wire.MsgBlock
|
var bestBlock *wire.MsgBlock
|
||||||
@@ -126,7 +126,7 @@ func (h *HarnessTest) cleanMempool() {
|
|||||||
// If mempool is empty, exit.
|
// If mempool is empty, exit.
|
||||||
mem := h.Miner.GetRawMempool()
|
mem := h.Miner.GetRawMempool()
|
||||||
if len(mem) == 0 {
|
if len(mem) == 0 {
|
||||||
_, height := h.Miner.GetBestBlock()
|
_, height := h.GetBestBlock()
|
||||||
h.Logf("Mined %d blocks when cleanup the mempool",
|
h.Logf("Mined %d blocks when cleanup the mempool",
|
||||||
height-startHeight)
|
height-startHeight)
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@ func (h *HarnessTest) cleanMempool() {
|
|||||||
// TODO(yy): remove this workaround when syncing blocks are unified in all the
|
// TODO(yy): remove this workaround when syncing blocks are unified in all the
|
||||||
// subsystems.
|
// subsystems.
|
||||||
func (h *HarnessTest) mineTillForceCloseResolved(hn *node.HarnessNode) {
|
func (h *HarnessTest) mineTillForceCloseResolved(hn *node.HarnessNode) {
|
||||||
_, startHeight := h.Miner.GetBestBlock()
|
_, startHeight := h.GetBestBlock()
|
||||||
|
|
||||||
err := wait.NoError(func() error {
|
err := wait.NoError(func() error {
|
||||||
resp := hn.RPC.PendingChannels()
|
resp := hn.RPC.PendingChannels()
|
||||||
@@ -169,7 +169,7 @@ func (h *HarnessTest) mineTillForceCloseResolved(hn *node.HarnessNode) {
|
|||||||
"close channel to be zero")
|
"close channel to be zero")
|
||||||
}
|
}
|
||||||
|
|
||||||
_, height := h.Miner.GetBestBlock()
|
_, height := h.GetBestBlock()
|
||||||
h.Logf("Mined %d blocks while waiting for force closed "+
|
h.Logf("Mined %d blocks while waiting for force closed "+
|
||||||
"channel to be resolved", height-startHeight)
|
"channel to be resolved", height-startHeight)
|
||||||
|
|
||||||
@@ -179,6 +179,21 @@ func (h *HarnessTest) mineTillForceCloseResolved(hn *node.HarnessNode) {
|
|||||||
require.NoErrorf(h, err, "assert force close resolved timeout")
|
require.NoErrorf(h, err, "assert force close resolved timeout")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AssertTxInMempool asserts a given transaction can be found in the mempool.
|
||||||
|
func (h *HarnessTest) AssertTxInMempool(txid *chainhash.Hash) *wire.MsgTx {
|
||||||
|
return h.Miner.AssertTxInMempool(txid)
|
||||||
|
}
|
||||||
|
|
||||||
|
// AssertTxNotInMempool asserts a given transaction cannot be found in the
|
||||||
|
// mempool. It assumes the mempool is not empty.
|
||||||
|
//
|
||||||
|
// NOTE: this should be used after `AssertTxInMempool` to ensure the tx has
|
||||||
|
// entered the mempool before. Otherwise it might give false positive and the
|
||||||
|
// tx may enter the mempool after the check.
|
||||||
|
func (h *HarnessTest) AssertTxNotInMempool(txid chainhash.Hash) *wire.MsgTx {
|
||||||
|
return h.Miner.AssertTxNotInMempool(txid)
|
||||||
|
}
|
||||||
|
|
||||||
// AssertNumTxsInMempool polls until finding the desired number of transactions
|
// AssertNumTxsInMempool polls until finding the desired number of transactions
|
||||||
// in the provided miner's mempool. It will asserrt if this number is not met
|
// in the provided miner's mempool. It will asserrt if this number is not met
|
||||||
// after the given timeout.
|
// after the given timeout.
|
||||||
@@ -186,9 +201,25 @@ func (h *HarnessTest) AssertNumTxsInMempool(n int) []*chainhash.Hash {
|
|||||||
return h.Miner.AssertNumTxsInMempool(n)
|
return h.Miner.AssertNumTxsInMempool(n)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AssertOutpointInMempool asserts a given outpoint can be found in the mempool.
|
||||||
|
func (h *HarnessTest) AssertOutpointInMempool(op wire.OutPoint) *wire.MsgTx {
|
||||||
|
return h.Miner.AssertOutpointInMempool(op)
|
||||||
|
}
|
||||||
|
|
||||||
// AssertTxInBlock asserts that a given txid can be found in the passed block.
|
// AssertTxInBlock asserts that a given txid can be found in the passed block.
|
||||||
func (h *HarnessTest) AssertTxInBlock(block *wire.MsgBlock,
|
func (h *HarnessTest) AssertTxInBlock(block *wire.MsgBlock,
|
||||||
txid *chainhash.Hash) {
|
txid *chainhash.Hash) {
|
||||||
|
|
||||||
h.Miner.AssertTxInBlock(block, txid)
|
h.Miner.AssertTxInBlock(block, txid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetNumTxsFromMempool polls until finding the desired number of transactions
|
||||||
|
// in the miner's mempool and returns the full transactions to the caller.
|
||||||
|
func (h *HarnessTest) GetNumTxsFromMempool(n int) []*wire.MsgTx {
|
||||||
|
return h.Miner.GetNumTxsFromMempool(n)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetBestBlock makes a RPC request to miner and asserts.
|
||||||
|
func (h *HarnessTest) GetBestBlock() (*chainhash.Hash, int32) {
|
||||||
|
return h.Miner.GetBestBlock()
|
||||||
|
}
|
||||||
Reference in new issue
Block a user