lntest+itest: finalize moving miner methods

This commit is contained in:
yyforyongyu 2024-05-01 20:41:47 +08:00 committed by yyforyongyu
parent 6bd8baea38
commit be4dba5da6
No known key found for this signature in database
GPG Key ID: 9BCD95C4FF296868
18 changed files with 129 additions and 55 deletions

View File

@ -393,7 +393,7 @@ func channelForceClosureTest(ht *lntest.HarnessTest,
// Fetch the sweep transaction, all input it's spending should be from
// the commitment transaction which was broadcast on-chain.
sweepTx := ht.Miner.GetRawTransaction(sweepingTXID)
sweepTx := ht.GetRawTransaction(sweepingTXID)
for _, txIn := range sweepTx.MsgTx().TxIn {
require.Equal(ht, &txIn.PreviousOutPoint.Hash, closingTxID,
"sweep transaction not spending from commit")
@ -567,7 +567,7 @@ func channelForceClosureTest(ht *lntest.HarnessTest,
// on-chain. In case of an anchor type channel, we expect one
// extra input that is not spending from the commitment, that
// is added for fees.
htlcTx := ht.Miner.GetRawTransaction(htlcTxID)
htlcTx := ht.GetRawTransaction(htlcTxID)
// Ensure the htlc transaction has the expected number of
// inputs.
@ -736,7 +736,7 @@ func channelForceClosureTest(ht *lntest.HarnessTest,
htlcSweepTxID := ht.AssertNumTxsInMempool(1)[0]
// Fetch the htlc sweep transaction from the mempool.
htlcSweepTx := ht.Miner.GetRawTransaction(htlcSweepTxID)
htlcSweepTx := ht.GetRawTransaction(htlcSweepTxID)
// Ensure the htlc sweep transaction only has one input for each htlc
// Alice extended before force closing.

View File

@ -15,7 +15,6 @@ import (
"github.com/lightningnetwork/lnd/lnwallet"
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/stretchr/testify/require"
)
type chanFundMaxTestCase struct {
@ -317,8 +316,7 @@ func fundingFee(numInput int, change bool) btcutil.Amount {
// sweepNodeWalletAndAssert sweeps funds from a node wallet.
func sweepNodeWalletAndAssert(ht *lntest.HarnessTest, node *node.HarnessNode) {
// New miner address we will sweep all funds to.
minerAddr, err := ht.Miner.NewAddress()
require.NoError(ht, err)
minerAddr := ht.NewMinerAddress()
// Send all funds back to the miner node.
node.RPC.SendCoins(&lnrpc.SendCoinsRequest{

View File

@ -1053,7 +1053,7 @@ func testBatchChanFunding(ht *lntest.HarnessTest) {
ht.AssertTopologyChannelOpen(alice, chanPoint3)
// Check if the change type from the batch_open_channel funding is P2TR.
rawTx := ht.Miner.GetRawTransaction(txHash)
rawTx := ht.GetRawTransaction(txHash)
require.Len(ht, rawTx.MsgTx().TxOut, 5)
// For calculating the change output index we use the formula for the
@ -1182,9 +1182,9 @@ func deriveFundingShim(ht *lntest.HarnessTest, carol, dave *node.HarnessNode,
var txid *chainhash.Hash
targetOutputs := []*wire.TxOut{fundingOutput}
if publish {
txid = ht.Miner.SendOutputsWithoutChange(targetOutputs, 5)
txid = ht.SendOutputsWithoutChange(targetOutputs, 5)
} else {
tx := ht.Miner.CreateTransaction(targetOutputs, 5)
tx := ht.CreateTransaction(targetOutputs, 5)
txHash := tx.TxHash()
txid = &txHash

View File

@ -823,14 +823,14 @@ func testSweepAllCoins(ht *lntest.HarnessTest) {
// Send coins to a compatible address without specifying fee rate or
// conf target.
// ainz.RPC.SendCoinsAssertErr(&lnrpc.SendCoinsRequest{
// Addr: ht.Miner.NewMinerAddress().String(),
// Addr: ht.NewMinerAddress().String(),
// SendAll: true,
// Label: sendCoinsLabel,
// })
// Send coins to a compatible address.
ainz.RPC.SendCoins(&lnrpc.SendCoinsRequest{
Addr: ht.Miner.NewMinerAddress().String(),
Addr: ht.NewMinerAddress().String(),
SendAll: true,
Label: sendCoinsLabel,
TargetConf: 6,
@ -930,7 +930,7 @@ func testSweepAllCoins(ht *lntest.HarnessTest) {
// If we try again, but this time specifying an amount, then the call
// should fail.
ainz.RPC.SendCoinsAssertErr(&lnrpc.SendCoinsRequest{
Addr: ht.Miner.NewMinerAddress().String(),
Addr: ht.NewMinerAddress().String(),
Amount: 10000,
SendAll: true,
Label: sendCoinsLabel,

View File

@ -339,7 +339,7 @@ func runMultiHopHtlcLocalTimeout(ht *lntest.HarnessTest,
// TODO(yy): remove this once `blockbeat` is in place.
numExpected := 1
err := wait.NoError(func() error {
mem := ht.Miner.GetRawMempool()
mem := ht.GetRawMempool()
if len(mem) == 2 {
numExpected = 2
return nil
@ -2120,7 +2120,7 @@ func runMultiHopHtlcAggregation(ht *lntest.HarnessTest,
// TODO(yy): remove this once `blockbeat` is in place.
numExpected := 1
err := wait.NoError(func() error {
mem := ht.Miner.GetRawMempool()
mem := ht.GetRawMempool()
if len(mem) == numExpected {
return nil
}

View File

@ -97,7 +97,7 @@ func testNonStdSweepInner(ht *lntest.HarnessTest, address string) {
// Fetch the txid so we can grab the raw transaction.
txid := ht.AssertNumTxsInMempool(1)[0]
tx := ht.Miner.GetRawTransaction(txid)
tx := ht.GetRawTransaction(txid)
msgTx := tx.MsgTx()
@ -111,7 +111,7 @@ func testNonStdSweepInner(ht *lntest.HarnessTest, address string) {
for _, inp := range msgTx.TxIn {
// Fetch the previous outpoint's value.
prevOut := inp.PreviousOutPoint
ptx := ht.Miner.GetRawTransaction(&prevOut.Hash)
ptx := ht.GetRawTransaction(&prevOut.Hash)
pout := ptx.MsgTx().TxOut[prevOut.Index]
inputVal += int(pout.Value)

View File

@ -321,7 +321,7 @@ func testAnchorReservedValue(ht *lntest.HarnessTest) {
// Alice tries to send all funds to an external address, the reserved
// value must stay in her wallet.
minerAddr := ht.Miner.NewMinerAddress()
minerAddr := ht.NewMinerAddress()
sweepReq = &lnrpc.SendCoinsRequest{
Addr: minerAddr.String(),
@ -544,7 +544,7 @@ func testAnchorThirdPartySpend(ht *lntest.HarnessTest) {
// With the anchor output located, and the main commitment mined we'll
// instruct the wallet to send all coins in the wallet to a new address
// (to the miner), including unconfirmed change.
minerAddr := ht.Miner.NewMinerAddress()
minerAddr := ht.NewMinerAddress()
sweepReq := &lnrpc.SendCoinsRequest{
Addr: minerAddr.String(),
SendAll: true,
@ -574,7 +574,7 @@ func testAnchorThirdPartySpend(ht *lntest.HarnessTest) {
// mine a transaction that double spends the output.
thirdPartyAnchorSweep := genAnchorSweep(ht, aliceSweep, anchor.Outpoint)
ht.Logf("Third party tx=%v", thirdPartyAnchorSweep.TxHash())
ht.Miner.MineBlockWithTx(thirdPartyAnchorSweep)
ht.MineBlockWithTx(thirdPartyAnchorSweep)
// At this point, we should no longer find Alice's transaction that
// tried to sweep the anchor in her wallet.
@ -673,7 +673,7 @@ func genAnchorSweep(ht *lntest.HarnessTest, aliceSweep *wire.MsgTx,
aliceAnchorTxIn.Witness[0] = nil
aliceAnchorTxIn.Sequence = 16
minerAddr := ht.Miner.NewMinerAddress()
minerAddr := ht.NewMinerAddress()
addrScript, err := txscript.PayToAddrScript(minerAddr)
require.NoError(ht, err, "unable to gen addr script")
@ -766,7 +766,7 @@ func testRemoveTx(ht *lntest.HarnessTest) {
// Mine a block and make sure the transaction previously broadcasted
// shows up in alice's wallet although we removed the transaction from
// the wallet when it was unconfirmed.
block := ht.Miner.MineBlocks(1)[0]
block := ht.MineBlocksAndAssertNumTxes(1, 1)[0]
ht.AssertTxInBlock(block, txID)
// Verify that alice has 2 confirmed unspent utxos in her default

View File

@ -30,7 +30,7 @@ func testOpenChannelAfterReorg(ht *lntest.HarnessTest) {
}
// Create a temp miner.
tempMiner := ht.Miner.SpawnTempMiner()
tempMiner := ht.SpawnTempMiner()
miner := ht.Miner
alice, bob := ht.Alice, ht.Bob

View File

@ -464,7 +464,7 @@ func runPsbtChanFundingExternal(ht *lntest.HarnessTest, carol,
require.NoError(ht, err)
txHash := finalTx.TxHash()
_, err = ht.Miner.Client.SendRawTransaction(&finalTx, false)
_, err = ht.SendRawTransaction(&finalTx, false)
require.NoError(ht, err)
// Now we can mine a block to get the transaction confirmed, then wait

View File

@ -252,7 +252,7 @@ func testOnchainFundRecovery(ht *lntest.HarnessTest) {
promptChangeAddr := func(node *node.HarnessNode) {
ht.Helper()
minerAddr := ht.Miner.NewMinerAddress()
minerAddr := ht.NewMinerAddress()
req := &lnrpc.SendCoinsRequest{
Addr: minerAddr.String(),
Amount: minerAmt,

View File

@ -570,13 +570,13 @@ func revokedCloseRetributionRemoteHodlCase(ht *lntest.HarnessTest,
var justiceTxid *chainhash.Hash
errNotFound := errors.New("justice tx not found")
findJusticeTx := func() (*chainhash.Hash, error) {
mempool := ht.Miner.GetRawMempool()
mempool := ht.GetRawMempool()
for _, txid := range mempool {
// Check that the justice tx has the appropriate number
// of inputs.
//
// NOTE: We don't use `ht.Miner.GetRawTransaction`
// NOTE: We don't use `ht.GetRawTransaction`
// which asserts a txid must be found as the HTLC
// spending txes might be aggregated.
tx, err := ht.Miner.Client.GetRawTransaction(txid)
@ -626,14 +626,14 @@ func revokedCloseRetributionRemoteHodlCase(ht *lntest.HarnessTest,
}
require.NoError(ht, err, "timeout finding justice tx")
justiceTx := ht.Miner.GetRawTransaction(justiceTxid)
justiceTx := ht.GetRawTransaction(justiceTxid)
// isSecondLevelSpend checks that the passed secondLevelTxid is a
// potentitial second level spend spending from the commit tx.
isSecondLevelSpend := func(commitTxid,
secondLevelTxid *chainhash.Hash) bool {
secondLevel := ht.Miner.GetRawTransaction(secondLevelTxid)
secondLevel := ht.GetRawTransaction(secondLevelTxid)
// A second level spend should have only one input, and one
// output.

View File

@ -1010,7 +1010,7 @@ func testErrorHandlingOnChainFailure(ht *lntest.HarnessTest) {
ht.MineBlocks(node.DefaultCSV - 1)
ht.AssertNumPendingSweeps(ht.Bob, 1)
ht.MineEmptyBlocks(1)
ht.Miner.MineBlocksAndAssertNumTxes(1, 1)
ht.MineBlocksAndAssertNumTxes(1, 1)
// Restart bob so that we can test that he's able to recover everything
// he needs to claim a blinded HTLC.
@ -1026,8 +1026,8 @@ func testErrorHandlingOnChainFailure(ht *lntest.HarnessTest) {
// Wait for Bob's timeout transaction in the mempool, since we've
// suspended Carol we don't need to account for her commitment output
// claim.
ht.Miner.MineBlocksAndAssertNumTxes(1, 1)
ht.AssertNumPendingSweeps(ht.Bob, 0)
ht.MineBlocksAndAssertNumTxes(1, 1)
// Assert that the HTLC has cleared.
ht.WaitForBlockchainSync(ht.Bob)
@ -1049,7 +1049,7 @@ func testErrorHandlingOnChainFailure(ht *lntest.HarnessTest) {
// Clean up the rest of our force close: mine blocks so that Bob's CSV
// expires plus one block to trigger his sweep and then mine it.
ht.MineBlocks(node.DefaultCSV + 1)
ht.Miner.MineBlocksAndAssertNumTxes(1, 1)
ht.MineBlocksAndAssertNumTxes(1, 1)
// Bring carol back up so that we can close out the rest of our
// channels cooperatively. She requires an interceptor to start up

View File

@ -168,7 +168,7 @@ func testSweepCPFPAnchorOutgoingTimeout(ht *lntest.HarnessTest) {
ht.MineEmptyBlocks(int(numBlocks))
// Assert Bob's force closing tx has been broadcast.
closeTxid := ht.Miner.AssertNumTxsInMempool(1)[0]
closeTxid := ht.AssertNumTxsInMempool(1)[0]
// Remember the force close height so we can calculate the deadline
// height.
@ -517,7 +517,7 @@ func testSweepCPFPAnchorIncomingTimeout(ht *lntest.HarnessTest) {
ht.MineEmptyBlocks(int(numBlocks))
// Assert Bob's force closing tx has been broadcast.
closeTxid := ht.Miner.AssertNumTxsInMempool(1)[0]
closeTxid := ht.AssertNumTxsInMempool(1)[0]
// Bob should have two pending sweeps,
// - anchor sweeping from his local commitment.
@ -546,7 +546,7 @@ func testSweepCPFPAnchorIncomingTimeout(ht *lntest.HarnessTest) {
//
// We should see Bob's anchor sweeping tx triggered by the above
// block, along with his force close tx.
txns := ht.Miner.GetNumTxsFromMempool(2)
txns := ht.GetNumTxsFromMempool(2)
// Find the sweeping tx.
sweepTx := ht.FindSweepingTxns(txns, 1, *closeTxid)[0]
@ -598,12 +598,12 @@ func testSweepCPFPAnchorIncomingTimeout(ht *lntest.HarnessTest) {
// Make sure Bob's old sweeping tx has been removed from the
// mempool.
ht.Miner.AssertTxNotInMempool(sweepTx.TxHash())
ht.AssertTxNotInMempool(sweepTx.TxHash())
// We expect to see two txns in the mempool,
// - Bob's force close tx.
// - Bob's anchor sweep tx.
ht.Miner.AssertNumTxsInMempool(2)
ht.AssertNumTxsInMempool(2)
// We expect the fees to increase by i*delta.
expectedFee := startFeeAnchor + feeDelta.MulF64(float64(i))
@ -613,7 +613,7 @@ func testSweepCPFPAnchorIncomingTimeout(ht *lntest.HarnessTest) {
// We should see Bob's anchor sweeping tx being fee bumped
// since it's not confirmed, along with his force close tx.
txns = ht.Miner.GetNumTxsFromMempool(2)
txns = ht.GetNumTxsFromMempool(2)
// Find the sweeping tx.
sweepTx = ht.FindSweepingTxns(txns, 1, *closeTxid)[0]
@ -648,11 +648,11 @@ func testSweepCPFPAnchorIncomingTimeout(ht *lntest.HarnessTest) {
ht.MineEmptyBlocks(1)
// 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
// sweeping tx and his force close tx.
txns = ht.Miner.GetNumTxsFromMempool(2)
txns = ht.GetNumTxsFromMempool(2)
// Find the sweeping tx.
sweepTx = ht.FindSweepingTxns(txns, 1, *closeTxid)[0]
@ -673,7 +673,7 @@ func testSweepCPFPAnchorIncomingTimeout(ht *lntest.HarnessTest) {
//
// We expect two txns here, one for the anchor sweeping, the other for
// the force close tx.
txns = ht.Miner.GetNumTxsFromMempool(2)
txns = ht.GetNumTxsFromMempool(2)
// Find the sweeping tx.
currentSweepTx := ht.FindSweepingTxns(txns, 1, *closeTxid)[0]
@ -1029,7 +1029,7 @@ func testSweepHTLCs(ht *lntest.HarnessTest) {
// We don't care the behavior of the anchor sweep in this test, so we
// mine the force close tx to trigger Bob's contractcourt to offer his
// incoming HTLC to his sweeper.
ht.Miner.MineBlockWithTx(closeTx)
ht.MineBlockWithTx(closeTx)
// Update Bob's fee function position.
outgoingFuncPosition++
@ -1088,7 +1088,7 @@ func testSweepHTLCs(ht *lntest.HarnessTest) {
incomingFuncPosition := int32(0)
// Mine the anchor sweeping tx to reduce noise in this test.
ht.Miner.MineBlockWithTxes([]*btcutil.Tx{btcutil.NewTx(anchorSweep)})
ht.MineBlockWithTx(anchorSweep)
// Update the fee function's positions.
outgoingFuncPosition++
@ -1456,7 +1456,7 @@ func testSweepCommitOutputAndAnchor(ht *lntest.HarnessTest) {
aliceStartPosition := 0
var aliceFirstSweepTx *wire.MsgTx
err := wait.NoError(func() error {
mem := ht.Miner.GetRawMempool()
mem := ht.GetRawMempool()
if len(mem) != 2 {
return fmt.Errorf("want 2, got %v in mempool: %v",
len(mem), mem)
@ -1486,7 +1486,7 @@ func testSweepCommitOutputAndAnchor(ht *lntest.HarnessTest) {
// block would trigger an RBF. We now need to assert the mempool has
// removed the replaced tx.
if aliceFirstSweepTx != nil {
ht.Miner.AssertTxNotInMempool(aliceFirstSweepTx.TxHash())
ht.AssertTxNotInMempool(aliceFirstSweepTx.TxHash())
}
// We also remember the positions of fee functions used by Alice and
@ -1604,7 +1604,7 @@ func testSweepCommitOutputAndAnchor(ht *lntest.HarnessTest) {
// Make sure Alice's old sweeping tx has been removed from the
// mempool.
ht.Miner.AssertTxNotInMempool(aliceSweepTx.TxHash())
ht.AssertTxNotInMempool(aliceSweepTx.TxHash())
// We should see two txns in the mempool:
// - Alice's sweeping tx, which sweeps both her anchor and

View File

@ -1850,7 +1850,7 @@ func testTaprootCoopClose(ht *lntest.HarnessTest) {
// assertTaprootDeliveryUsed returns true if a Taproot addr was used in
// the co-op close transaction.
assertTaprootDeliveryUsed := func(closingTxid *chainhash.Hash) bool {
tx := ht.Miner.GetRawTransaction(closingTxid)
tx := ht.GetRawTransaction(closingTxid)
for _, txOut := range tx.MsgTx().TxOut {
if !txscript.IsPayToTaproot(txOut.PkScript) {
return false

View File

@ -86,7 +86,7 @@ func testTowerClientTowerAndSessionManagement(ht *lntest.HarnessTest) {
}
if mineOnFail {
ht.Miner.MineBlocksSlow(1)
ht.MineBlocks(1)
}
return fmt.Errorf("expected %d sessions, got %d",
@ -515,7 +515,7 @@ func testRevokedCloseRetributionAltruistWatchtowerCase(ht *lntest.HarnessTest,
// Query for the mempool transaction found above. Then assert that all
// the inputs of this transaction are spending outputs generated by
// Carol's breach transaction above.
justiceTx := ht.Miner.GetRawTransaction(justiceTXID)
justiceTx := ht.GetRawTransaction(justiceTXID)
for _, txIn := range justiceTx.MsgTx().TxIn {
require.Equal(ht, breachTXID[:], txIn.PreviousOutPoint.Hash[:],
"justice tx not spending commitment utxo")
@ -702,7 +702,7 @@ func assertNumBackups(ht *lntest.HarnessTest, node *rpc.HarnessRPC,
}
if mineOnFail {
ht.Miner.MineBlocksSlow(1)
ht.MineBlocks(1)
}
return fmt.Errorf("expected %d backups, got %d",

View File

@ -950,7 +950,7 @@ func testZeroConfReorg(ht *lntest.HarnessTest) {
// exists in the graph.
//
// First, we'll setup a new miner that we can use to cause a reorg.
tempMiner := ht.Miner.SpawnTempMiner()
tempMiner := ht.SpawnTempMiner()
// We now cause a fork, by letting our original miner mine 1 block and
// our new miner will mine 2. We also expect the funding transition to
@ -959,7 +959,7 @@ func testZeroConfReorg(ht *lntest.HarnessTest) {
tempMiner.MineEmptyBlocks(2)
// Ensure the temp miner is one block ahead.
ht.Miner.AssertMinerBlockHeightDelta(tempMiner, 1)
ht.AssertMinerBlockHeightDelta(tempMiner, 1)
// Wait for Carol to sync to the original miner's chain.
_, minerHeight := ht.GetBestBlock()
@ -972,14 +972,14 @@ func testZeroConfReorg(ht *lntest.HarnessTest) {
// Connecting to the temporary miner should cause the original miner to
// reorg to the longer chain.
ht.Miner.ConnectMiner(tempMiner)
ht.ConnectToMiner(tempMiner)
// They should now be on the same chain.
ht.Miner.AssertMinerBlockHeightDelta(tempMiner, 0)
ht.AssertMinerBlockHeightDelta(tempMiner, 0)
// Now we disconnect the two miners and reconnect our original chain
// backend.
ht.Miner.DisconnectMiner(tempMiner)
ht.DisconnectFromMiner(tempMiner)
ht.ConnectMiner()

View File

@ -4,8 +4,10 @@ import (
"fmt"
"github.com/btcsuite/btcd/blockchain"
"github.com/btcsuite/btcd/btcutil"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
"github.com/lightningnetwork/lnd/lntest/miner"
"github.com/lightningnetwork/lnd/lntest/node"
"github.com/lightningnetwork/lnd/lntest/wait"
"github.com/stretchr/testify/require"
@ -223,3 +225,77 @@ func (h *HarnessTest) GetNumTxsFromMempool(n int) []*wire.MsgTx {
func (h *HarnessTest) GetBestBlock() (*chainhash.Hash, int32) {
return h.Miner.GetBestBlock()
}
// MineBlockWithTx mines a single block to include the specifies tx only.
func (h *HarnessTest) MineBlockWithTx(tx *wire.MsgTx) *wire.MsgBlock {
return h.Miner.MineBlockWithTx(tx)
}
// ConnectToMiner connects the miner to a temp miner.
func (h *HarnessTest) ConnectToMiner(tempMiner *miner.HarnessMiner) {
h.Miner.ConnectMiner(tempMiner)
}
// DisconnectFromMiner disconnects the miner from the temp miner.
func (h *HarnessTest) DisconnectFromMiner(tempMiner *miner.HarnessMiner) {
h.Miner.DisconnectMiner(tempMiner)
}
// GetRawMempool makes a RPC call to the miner's GetRawMempool and
// asserts.
func (h *HarnessTest) GetRawMempool() []*chainhash.Hash {
return h.Miner.GetRawMempool()
}
// GetRawTransaction makes a RPC call to the miner's GetRawTransaction and
// asserts.
func (h *HarnessTest) GetRawTransaction(txid *chainhash.Hash) *btcutil.Tx {
return h.Miner.GetRawTransaction(txid)
}
// NewMinerAddress creates a new address for the miner and asserts.
func (h *HarnessTest) NewMinerAddress() btcutil.Address {
return h.Miner.NewMinerAddress()
}
// SpawnTempMiner creates a temp miner and syncs it with the current miner.
// Once miners are synced, the temp miner is disconnected from the original
// miner and returned.
func (h *HarnessTest) SpawnTempMiner() *miner.HarnessMiner {
return h.Miner.SpawnTempMiner()
}
// CreateTransaction uses the miner to create a transaction using the given
// outputs using the specified fee rate and returns the transaction.
func (h *HarnessTest) CreateTransaction(outputs []*wire.TxOut,
feeRate btcutil.Amount) *wire.MsgTx {
return h.Miner.CreateTransaction(outputs, feeRate)
}
// SendOutputsWithoutChange uses the miner to send the given outputs using the
// specified fee rate and returns the txid.
func (h *HarnessTest) SendOutputsWithoutChange(outputs []*wire.TxOut,
feeRate btcutil.Amount) *chainhash.Hash {
return h.Miner.SendOutputsWithoutChange(outputs, feeRate)
}
// AssertMinerBlockHeightDelta ensures that tempMiner is 'delta' blocks ahead
// of miner.
func (h *HarnessTest) AssertMinerBlockHeightDelta(
tempMiner *miner.HarnessMiner, delta int32) {
h.Miner.AssertMinerBlockHeightDelta(tempMiner, delta)
}
// SendRawTransaction submits the encoded transaction to the server which will
// then relay it to the network.
func (h *HarnessTest) SendRawTransaction(tx *wire.MsgTx,
allowHighFees bool) (chainhash.Hash, error) {
txid, err := h.Miner.Client.SendRawTransaction(tx, allowHighFees)
require.NoError(h, err)
return *txid, nil
}

View File

@ -410,7 +410,7 @@ func (h *HarnessMiner) AssertOutpointInMempool(op wire.OutPoint) *wire.MsgTx {
}
for _, txid := range mempool {
// We don't use `ht.Miner.GetRawTransaction` which
// We don't use `ht.GetRawTransaction` which
// asserts a txid must be found. While iterating here,
// the actual mempool state might have been changed,
// causing a given txid being removed and cannot be