build: update btcd and btcwallet dependencies

This commit is contained in:
Wilmer Paulino committed 2021-04-05 15:41:04 -07:00
1 parent a329c80612
commit a620ce3682
25 files changed
+327 -317

No files matched your search

+2 -2
View File
@@ -56,12 +56,12 @@ func (b BtcdBackendConfig) GenArgs() []string {
// ConnectMiner is called to establish a connection to the test miner.
func (b BtcdBackendConfig) ConnectMiner() error {
return b.harness.Node.Node(btcjson.NConnect, b.minerAddr, &temp)
return b.harness.Client.Node(btcjson.NConnect, b.minerAddr, &temp)
}
// DisconnectMiner is called to disconnect the miner.
func (b BtcdBackendConfig) DisconnectMiner() error {
return b.harness.Node.Node(btcjson.NDisconnect, b.minerAddr, &temp)
return b.harness.Client.Node(btcjson.NDisconnect, b.minerAddr, &temp)
}
// Name returns the name of the backend type.
+3 -3
View File
@@ -211,7 +211,7 @@ func (n *NetworkHarness) SetUp(testCase string, lndArgs []string) error {
// We generate several blocks in order to give the outputs created
// above a good number of confirmations.
if _, err := n.Miner.Node.Generate(10); err != nil {
if _, err := n.Miner.Client.Generate(10); err != nil {
return err
}
@@ -803,7 +803,7 @@ func (n *NetworkHarness) WaitForTxInMempool(ctx context.Context,
case <-ticker.C:
var err error
mempool, err = n.Miner.Node.GetRawMempool()
mempool, err = n.Miner.Client.GetRawMempool()
if err != nil {
return err
}
@@ -1383,7 +1383,7 @@ func (n *NetworkHarness) sendCoins(ctx context.Context, amt btcutil.Amount,
// Otherwise, we'll generate 6 new blocks to ensure the output gains a
// sufficient number of confirmations and wait for the balance to
// reflect what's expected.
if _, err := n.Miner.Node.Generate(6); err != nil {
if _, err := n.Miner.Client.Generate(6); err != nil {
return err
}
@@ -176,7 +176,7 @@ func testMultiHopHtlcAggregation(net *lntest.NetworkHarness, t *harnessTest,
numBlocks := padCLTV(
uint32(finalCltvDelta - lncfg.DefaultOutgoingBroadcastDelta),
)
_, err = net.Miner.Node.Generate(numBlocks)
_, err = net.Miner.Client.Generate(numBlocks)
require.NoError(t.t, err)
// Bob's force close transaction should now be found in the mempool. If
@@ -189,11 +189,11 @@ func testMultiHopHtlcAggregation(net *lntest.NetworkHarness, t *harnessTest,
bobFundingTxid, err := lnrpc.GetChanPointFundingTxid(bobChanPoint)
require.NoError(t.t, err)
_, err = waitForNTxsInMempool(
net.Miner.Node, expectedTxes, minerMempoolTimeout,
net.Miner.Client, expectedTxes, minerMempoolTimeout,
)
require.NoError(t.t, err)
closeTx := getSpendingTxInMempool(
t, net.Miner.Node, minerMempoolTimeout, wire.OutPoint{
t, net.Miner.Client, minerMempoolTimeout, wire.OutPoint{
Hash: *bobFundingTxid,
Index: bobChanPoint.OutputIndex,
},
@@ -258,7 +258,7 @@ func testMultiHopHtlcAggregation(net *lntest.NetworkHarness, t *harnessTest,
}
txes, err := getNTxsFromMempool(
net.Miner.Node, expectedTxes, minerMempoolTimeout,
net.Miner.Client, expectedTxes, minerMempoolTimeout,
)
require.NoError(t.t, err)
@@ -334,13 +334,13 @@ func testMultiHopHtlcAggregation(net *lntest.NetworkHarness, t *harnessTest,
// If we then mine additional blocks, Bob can sweep his commitment
// output.
_, err = net.Miner.Node.Generate(defaultCSV - 2)
_, err = net.Miner.Client.Generate(defaultCSV - 2)
require.NoError(t.t, err)
// Find the commitment sweep.
bobCommitSweepHash, err := waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
bobCommitSweepHash, err := waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
require.NoError(t.t, err)
bobCommitSweep, err := net.Miner.Node.GetRawTransaction(bobCommitSweepHash)
bobCommitSweep, err := net.Miner.Client.GetRawTransaction(bobCommitSweepHash)
require.NoError(t.t, err)
require.Equal(
@@ -375,11 +375,11 @@ func testMultiHopHtlcAggregation(net *lntest.NetworkHarness, t *harnessTest,
_ = mineBlocks(t, net, 2, 1)
}
bobSweep, err := waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
bobSweep, err := waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
require.NoError(t.t, err)
// Make sure it spends from the second level tx.
secondLevelSweep, err := net.Miner.Node.GetRawTransaction(bobSweep)
secondLevelSweep, err := net.Miner.Client.GetRawTransaction(bobSweep)
require.NoError(t.t, err)
// It should be sweeping all the second-level outputs.
@@ -97,7 +97,7 @@ func testMultiHopHtlcLocalChainClaim(net *lntest.NetworkHarness, t *harnessTest,
expectedTxes = 2
}
_, err = waitForNTxsInMempool(
net.Miner.Node, expectedTxes, minerMempoolTimeout,
net.Miner.Client, expectedTxes, minerMempoolTimeout,
)
require.NoError(t.t, err)
@@ -122,13 +122,13 @@ func testMultiHopHtlcLocalChainClaim(net *lntest.NetworkHarness, t *harnessTest,
numBlocks := padCLTV(uint32(invoiceReq.CltvExpiry -
lncfg.DefaultIncomingBroadcastDelta))
_, err = net.Miner.Node.Generate(numBlocks)
_, err = net.Miner.Client.Generate(numBlocks)
require.NoError(t.t, err)
// Carol's commitment transaction should now be in the mempool. If there
// is an anchor, Carol will sweep that too.
_, err = waitForNTxsInMempool(
net.Miner.Node, expectedTxes, minerMempoolTimeout,
net.Miner.Client, expectedTxes, minerMempoolTimeout,
)
require.NoError(t.t, err)
bobFundingTxid, err := lnrpc.GetChanPointFundingTxid(bobChanPoint)
@@ -141,7 +141,7 @@ func testMultiHopHtlcLocalChainClaim(net *lntest.NetworkHarness, t *harnessTest,
// Look up the closing transaction. It should be spending from the
// funding transaction,
closingTx := getSpendingTxInMempool(
t, net.Miner.Node, minerMempoolTimeout, carolFundingPoint,
t, net.Miner.Client, minerMempoolTimeout, carolFundingPoint,
)
closingTxid := closingTx.TxHash()
@@ -166,7 +166,7 @@ func testMultiHopHtlcLocalChainClaim(net *lntest.NetworkHarness, t *harnessTest,
expectedTxes = 3
}
txes, err := getNTxsFromMempool(
net.Miner.Node, expectedTxes, minerMempoolTimeout,
net.Miner.Client, expectedTxes, minerMempoolTimeout,
)
require.NoError(t.t, err)
@@ -206,12 +206,12 @@ func testMultiHopHtlcLocalChainClaim(net *lntest.NetworkHarness, t *harnessTest,
// will extract the preimage and broadcast a second level tx to claim
// the HTLC in his (already closed) channel with Alice.
bobSecondLvlTx, err := waitForTxInMempool(
net.Miner.Node, minerMempoolTimeout,
net.Miner.Client, minerMempoolTimeout,
)
require.NoError(t.t, err)
// It should spend from the commitment in the channel with Alice.
tx, err := net.Miner.Node.GetRawTransaction(bobSecondLvlTx)
tx, err := net.Miner.Client.GetRawTransaction(bobSecondLvlTx)
require.NoError(t.t, err)
require.Equal(
@@ -261,11 +261,11 @@ func testMultiHopHtlcLocalChainClaim(net *lntest.NetworkHarness, t *harnessTest,
// If we then mine 3 additional blocks, Carol's second level tx should
// mature, and she can pull the funds from it with a sweep tx.
_, err = net.Miner.Node.Generate(carolSecondLevelCSV)
_, err = net.Miner.Client.Generate(carolSecondLevelCSV)
require.NoError(t.t, err)
bobSecondLevelCSV -= carolSecondLevelCSV
carolSweep, err := waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
carolSweep, err := waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
require.NoError(t.t, err)
// Mining one additional block, Bob's second level tx is mature, and he
@@ -273,11 +273,11 @@ func testMultiHopHtlcLocalChainClaim(net *lntest.NetworkHarness, t *harnessTest,
block = mineBlocks(t, net, bobSecondLevelCSV, 1)[0]
assertTxInBlock(t, block, carolSweep)
bobSweep, err := waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
bobSweep, err := waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
require.NoError(t.t, err)
// Make sure it spends from the second level tx.
tx, err = net.Miner.Node.GetRawTransaction(bobSweep)
tx, err = net.Miner.Client.GetRawTransaction(bobSweep)
require.NoError(t.t, err)
require.Equal(
t.t, *bobSecondLvlTx, tx.MsgTx().TxIn[0].PreviousOutPoint.Hash,
@@ -98,7 +98,7 @@ func testMultiHopHtlcLocalTimeout(net *lntest.NetworkHarness, t *harnessTest,
numBlocks := padCLTV(
uint32(finalCltvDelta - lncfg.DefaultOutgoingBroadcastDelta),
)
_, err = net.Miner.Node.Generate(numBlocks)
_, err = net.Miner.Client.Generate(numBlocks)
require.NoError(t.t, err)
// Bob's force close transaction should now be found in the mempool. If
@@ -111,11 +111,11 @@ func testMultiHopHtlcLocalTimeout(net *lntest.NetworkHarness, t *harnessTest,
bobFundingTxid, err := lnrpc.GetChanPointFundingTxid(bobChanPoint)
require.NoError(t.t, err)
_, err = waitForNTxsInMempool(
net.Miner.Node, expectedTxes, minerMempoolTimeout,
net.Miner.Client, expectedTxes, minerMempoolTimeout,
)
require.NoError(t.t, err)
closeTx := getSpendingTxInMempool(
t, net.Miner.Node, minerMempoolTimeout, wire.OutPoint{
t, net.Miner.Client, minerMempoolTimeout, wire.OutPoint{
Hash: *bobFundingTxid,
Index: bobChanPoint.OutputIndex,
},
@@ -138,7 +138,7 @@ func testMultiHopHtlcLocalTimeout(net *lntest.NetworkHarness, t *harnessTest,
// timeout transaction to be broadcast due to the expiry being reached.
// If there are anchors, we also expect Carol's anchor sweep now.
txes, err := getNTxsFromMempool(
net.Miner.Node, expectedTxes, minerMempoolTimeout,
net.Miner.Client, expectedTxes, minerMempoolTimeout,
)
require.NoError(t.t, err)
@@ -166,7 +166,7 @@ func testMultiHopHtlcLocalTimeout(net *lntest.NetworkHarness, t *harnessTest,
mineBlocks(t, net, defaultCSV-1, expectedTxes)
// Check that the sweep spends from the mined commitment.
txes, err = getNTxsFromMempool(net.Miner.Node, 1, minerMempoolTimeout)
txes, err = getNTxsFromMempool(net.Miner.Client, 1, minerMempoolTimeout)
require.NoError(t.t, err)
assertAllTxesSpendFrom(t, txes, closeTxid)
@@ -193,7 +193,7 @@ func testMultiHopHtlcLocalTimeout(net *lntest.NetworkHarness, t *harnessTest,
// layer sweep due to the CSV on the HTLC timeout output.
mineBlocks(t, net, 1, 0)
assertSpendingTxInMempool(
t, net.Miner.Node, minerMempoolTimeout, wire.OutPoint{
t, net.Miner.Client, minerMempoolTimeout, wire.OutPoint{
Hash: *htlcTimeout,
Index: 0,
},
@@ -218,7 +218,7 @@ func testMultiHopHtlcLocalTimeout(net *lntest.NetworkHarness, t *harnessTest,
// Next, we'll mine a final block that should confirm the second-layer
// sweeping transaction.
_, err = net.Miner.Node.Generate(1)
_, err = net.Miner.Client.Generate(1)
require.NoError(t.t, err)
// Once this transaction has been confirmed, Bob should detect that he
@@ -106,7 +106,7 @@ func testMultiHopReceiverChainClaim(net *lntest.NetworkHarness, t *harnessTest,
numBlocks := padCLTV(uint32(
invoiceReq.CltvExpiry - lncfg.DefaultIncomingBroadcastDelta,
))
_, err = net.Miner.Node.Generate(numBlocks)
_, err = net.Miner.Client.Generate(numBlocks)
require.NoError(t.t, err)
// At this point, Carol should broadcast her active commitment
@@ -117,7 +117,7 @@ func testMultiHopReceiverChainClaim(net *lntest.NetworkHarness, t *harnessTest,
expectedTxes = 2
}
_, err = getNTxsFromMempool(
net.Miner.Node, expectedTxes, minerMempoolTimeout,
net.Miner.Client, expectedTxes, minerMempoolTimeout,
)
require.NoError(t.t, err)
@@ -132,7 +132,7 @@ func testMultiHopReceiverChainClaim(net *lntest.NetworkHarness, t *harnessTest,
// The commitment transaction should be spending from the funding
// transaction.
closingTx := getSpendingTxInMempool(
t, net.Miner.Node, minerMempoolTimeout, carolFundingPoint,
t, net.Miner.Client, minerMempoolTimeout, carolFundingPoint,
)
closingTxid := closingTx.TxHash()
@@ -154,7 +154,7 @@ func testMultiHopReceiverChainClaim(net *lntest.NetworkHarness, t *harnessTest,
expectedTxes = 3
}
txes, err := getNTxsFromMempool(
net.Miner.Node, expectedTxes, minerMempoolTimeout,
net.Miner.Client, expectedTxes, minerMempoolTimeout,
)
require.NoError(t.t, err)
@@ -163,7 +163,7 @@ func testMultiHopReceiverChainClaim(net *lntest.NetworkHarness, t *harnessTest,
// We'll now mine an additional block which should confirm both the
// second layer transactions.
_, err = net.Miner.Node.Generate(1)
_, err = net.Miner.Client.Generate(1)
require.NoError(t.t, err)
time.Sleep(time.Second * 4)
@@ -197,17 +197,17 @@ func testMultiHopReceiverChainClaim(net *lntest.NetworkHarness, t *harnessTest,
// If we mine 4 additional blocks, then both outputs should now be
// mature.
_, err = net.Miner.Node.Generate(defaultCSV)
_, err = net.Miner.Client.Generate(defaultCSV)
require.NoError(t.t, err)
// We should have a new transaction in the mempool.
_, err = waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
_, err = waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
require.NoError(t.t, err)
// Finally, if we mine an additional block to confirm these two sweep
// transactions, Carol should not show a pending channel in her report
// afterwards.
_, err = net.Miner.Node.Generate(1)
_, err = net.Miner.Client.Generate(1)
require.NoError(t.t, err)
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
err = waitForNumChannelPendingForceClose(ctxt, carol, 0, nil)
@@ -101,7 +101,7 @@ func testMultiHopHtlcRemoteChainClaim(net *lntest.NetworkHarness, t *harnessTest
// type is of that type).
if c == commitTypeAnchors {
_, err = waitForNTxsInMempool(
net.Miner.Node, 1, minerMempoolTimeout,
net.Miner.Client, 1, minerMempoolTimeout,
)
if err != nil {
t.Fatalf("unable to find bob's anchor commit sweep: %v",
@@ -114,12 +114,12 @@ func testMultiHopHtlcRemoteChainClaim(net *lntest.NetworkHarness, t *harnessTest
// containing the commitment tx and the commit sweep tx will be
// broadcast immediately before it can be included in a block, so mine
// one less than defaultCSV in order to perform mempool assertions.
_, err = net.Miner.Node.Generate(defaultCSV - 1)
_, err = net.Miner.Client.Generate(defaultCSV - 1)
require.NoError(t.t, err)
// Alice should now sweep her funds.
_, err = waitForNTxsInMempool(
net.Miner.Node, 1, minerMempoolTimeout,
net.Miner.Client, 1, minerMempoolTimeout,
)
require.NoError(t.t, err)
@@ -145,7 +145,7 @@ func testMultiHopHtlcRemoteChainClaim(net *lntest.NetworkHarness, t *harnessTest
invoiceReq.CltvExpiry-lncfg.DefaultIncomingBroadcastDelta,
) - defaultCSV)
_, err = net.Miner.Node.Generate(numBlocks)
_, err = net.Miner.Client.Generate(numBlocks)
require.NoError(t.t, err)
expectedTxes := 1
@@ -156,7 +156,7 @@ func testMultiHopHtlcRemoteChainClaim(net *lntest.NetworkHarness, t *harnessTest
// Carol's commitment transaction should now be in the mempool. If
// there are anchors, Carol also sweeps her anchor.
_, err = waitForNTxsInMempool(
net.Miner.Node, expectedTxes, minerMempoolTimeout,
net.Miner.Client, expectedTxes, minerMempoolTimeout,
)
require.NoError(t.t, err)
bobFundingTxid, err := lnrpc.GetChanPointFundingTxid(bobChanPoint)
@@ -169,7 +169,7 @@ func testMultiHopHtlcRemoteChainClaim(net *lntest.NetworkHarness, t *harnessTest
// The closing transaction should be spending from the funding
// transaction.
closingTx := getSpendingTxInMempool(
t, net.Miner.Node, minerMempoolTimeout, carolFundingPoint,
t, net.Miner.Client, minerMempoolTimeout, carolFundingPoint,
)
closingTxid := closingTx.TxHash()
@@ -193,7 +193,7 @@ func testMultiHopHtlcRemoteChainClaim(net *lntest.NetworkHarness, t *harnessTest
expectedTxes = 3
}
txes, err := getNTxsFromMempool(
net.Miner.Node, expectedTxes, minerMempoolTimeout,
net.Miner.Client, expectedTxes, minerMempoolTimeout,
)
require.NoError(t.t, err)
@@ -211,12 +211,12 @@ func testMultiHopHtlcRemoteChainClaim(net *lntest.NetworkHarness, t *harnessTest
// will extract the preimage and broadcast a sweep tx to directly claim
// the HTLC in his (already closed) channel with Alice.
bobHtlcSweep, err := waitForTxInMempool(
net.Miner.Node, minerMempoolTimeout,
net.Miner.Client, minerMempoolTimeout,
)
require.NoError(t.t, err)
// It should spend from the commitment in the channel with Alice.
tx, err := net.Miner.Node.GetRawTransaction(bobHtlcSweep)
tx, err := net.Miner.Client.GetRawTransaction(bobHtlcSweep)
require.NoError(t.t, err)
require.Equal(
t.t, *aliceForceClose, tx.MsgTx().TxIn[0].PreviousOutPoint.Hash,
@@ -238,11 +238,11 @@ func testMultiHopHtlcRemoteChainClaim(net *lntest.NetworkHarness, t *harnessTest
// If we then mine 3 additional blocks, Carol's second level tx will
// mature, and she should pull the funds.
_, err = net.Miner.Node.Generate(carolSecondLevelCSV)
_, err = net.Miner.Client.Generate(carolSecondLevelCSV)
require.NoError(t.t, err)
carolSweep, err := waitForTxInMempool(
net.Miner.Node, minerMempoolTimeout,
net.Miner.Client, minerMempoolTimeout,
)
require.NoError(t.t, err)
@@ -96,7 +96,7 @@ func testMultiHopLocalForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness,
// transaction of Bob's funding output. If there are anchors, mine
// Carol's anchor sweep too.
if c == commitTypeAnchors {
_, err = waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
_, err = waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
require.NoError(t.t, err)
}
@@ -104,16 +104,16 @@ func testMultiHopLocalForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness,
// expires and the commitment was already mined inside
// closeChannelAndAssertType(), so mine one block less than defaultCSV
// in order to perform mempool assertions.
_, err = net.Miner.Node.Generate(defaultCSV - 1)
_, err = net.Miner.Client.Generate(defaultCSV - 1)
require.NoError(t.t, err)
_, err = waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
_, err = waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
require.NoError(t.t, err)
// We'll now mine enough blocks for the HTLC to expire. After this, Bob
// should hand off the now expired HTLC output to the utxo nursery.
numBlocks := padCLTV(uint32(finalCltvDelta - defaultCSV))
_, err = net.Miner.Node.Generate(numBlocks)
_, err = net.Miner.Client.Generate(numBlocks)
require.NoError(t.t, err)
// Bob's pending channel report should show that he has a single HTLC
@@ -138,7 +138,7 @@ func testMultiHopLocalForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness,
// We should also now find a transaction in the mempool, as Bob should
// have broadcast his second layer timeout transaction.
timeoutTx, err := waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
timeoutTx, err := waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
require.NoError(t.t, err)
// Next, we'll mine an additional block. This should serve to confirm
@@ -177,10 +177,10 @@ func testMultiHopLocalForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness,
// We'll now mine 4 additional blocks. This should be enough for Bob's
// CSV timelock to expire and the sweeping transaction of the HTLC to be
// broadcast.
_, err = net.Miner.Node.Generate(defaultCSV)
_, err = net.Miner.Client.Generate(defaultCSV)
require.NoError(t.t, err)
sweepTx, err := waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
sweepTx, err := waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
require.NoError(t.t, err)
// We'll then mine a final block which should confirm this second layer
@@ -93,7 +93,7 @@ func testMultiHopRemoteForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness,
}
_, err = waitForNTxsInMempool(
net.Miner.Node, expectedTxes, minerMempoolTimeout,
net.Miner.Client, expectedTxes, minerMempoolTimeout,
)
require.NoError(t.t, err)
@@ -101,7 +101,7 @@ func testMultiHopRemoteForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness,
// point, Bob should hand off the output to his internal utxo nursery,
// which will broadcast a sweep transaction.
numBlocks := padCLTV(finalCltvDelta - 1)
_, err = net.Miner.Node.Generate(numBlocks)
_, err = net.Miner.Client.Generate(numBlocks)
require.NoError(t.t, err)
// If we check Bob's pending channel report, it should show that he has
@@ -126,12 +126,12 @@ func testMultiHopRemoteForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness,
require.NoError(t.t, err)
// We need to generate an additional block to trigger the sweep.
_, err = net.Miner.Node.Generate(1)
_, err = net.Miner.Client.Generate(1)
require.NoError(t.t, err)
// Bob's sweeping transaction should now be found in the mempool at
// this point.
sweepTx, err := waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
sweepTx, err := waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
if err != nil {
// If Bob's transaction isn't yet in the mempool, then due to
// internal message passing and the low period between blocks
@@ -141,9 +141,9 @@ func testMultiHopRemoteForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness,
// we'll fail.
// TODO(halseth): can we use waitForChannelPendingForceClose to
// avoid this hack?
_, err = net.Miner.Node.Generate(1)
_, err = net.Miner.Client.Generate(1)
require.NoError(t.t, err)
sweepTx, err = waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
sweepTx, err = waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
require.NoError(t.t, err)
}
+3 -3
View File
@@ -58,14 +58,14 @@ func testCPFP(net *lntest.NetworkHarness, t *harnessTest) {
t.Fatalf("unable to send coins to bob: %v", err)
}
txid, err := waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
txid, err := waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
if err != nil {
t.Fatalf("expected one mempool transaction: %v", err)
}
// We'll then extract the raw transaction from the mempool in order to
// determine the index of Bob's output.
tx, err := net.Miner.Node.GetRawTransaction(txid)
tx, err := net.Miner.Client.GetRawTransaction(txid)
if err != nil {
t.Fatalf("unable to extract raw transaction from mempool: %v",
err)
@@ -110,7 +110,7 @@ func testCPFP(net *lntest.NetworkHarness, t *harnessTest) {
// We should now expect to see two transactions within the mempool, a
// parent and its child.
_, err = waitForNTxsInMempool(net.Miner.Node, 2, minerMempoolTimeout)
_, err = waitForNTxsInMempool(net.Miner.Client, 2, minerMempoolTimeout)
if err != nil {
t.Fatalf("expected two mempool transactions: %v", err)
}
+1 -1
View File
@@ -173,7 +173,7 @@ func testPsbtChanFunding(net *lntest.NetworkHarness, t *harnessTest) {
}
// No transaction should have been published yet.
mempool, err := net.Miner.Node.GetRawMempool()
mempool, err := net.Miner.Client.GetRawMempool()
require.NoError(t.t, err)
require.Equal(t.t, 0, len(mempool))
+4 -4
View File
@@ -190,7 +190,7 @@ func testRestAPI(net *lntest.NetworkHarness, ht *harnessTest) {
run: func(t *testing.T, a, b *lntest.HarnessNode) {
// Find out the current best block so we can subscribe
// to the next one.
hash, height, err := net.Miner.Node.GetBestBlock()
hash, height, err := net.Miner.Client.GetBestBlock()
require.Nil(t, err, "get best block")
// Create a new subscription to get block epoch events.
@@ -257,7 +257,7 @@ func testRestAPI(net *lntest.NetworkHarness, ht *harnessTest) {
}()
// Mine a block and make sure we get a message for it.
blockHashes, err := net.Miner.Node.Generate(1)
blockHashes, err := net.Miner.Client.Generate(1)
require.Nil(t, err, "generate blocks")
assert.Equal(t, 1, len(blockHashes), "num blocks")
select {
@@ -279,7 +279,7 @@ func testRestAPI(net *lntest.NetworkHarness, ht *harnessTest) {
run: func(t *testing.T, a, b *lntest.HarnessNode) {
// Find out the current best block so we can subscribe
// to the next one.
hash, height, err := net.Miner.Node.GetBestBlock()
hash, height, err := net.Miner.Client.GetBestBlock()
require.Nil(t, err, "get best block")
// Create a new subscription to get block epoch events.
@@ -366,7 +366,7 @@ func testRestAPI(net *lntest.NetworkHarness, ht *harnessTest) {
}()
// Mine a block and make sure we get a message for it.
blockHashes, err := net.Miner.Node.Generate(1)
blockHashes, err := net.Miner.Client.Generate(1)
require.Nil(t, err, "generate blocks")
assert.Equal(t, 1, len(blockHashes), "num blocks")
select {
+67 -71
View File
@@ -479,7 +479,7 @@ func cleanupForceClose(t *harnessTest, net *lntest.NetworkHarness,
//
// The commit sweep resolver is able to broadcast the sweep tx up to
// one block before the CSV elapses, so wait until defaulCSV-1.
_, err = net.Miner.Node.Generate(defaultCSV - 1)
_, err = net.Miner.Client.Generate(defaultCSV - 1)
if err != nil {
t.Fatalf("unable to generate blocks: %v", err)
}
@@ -812,7 +812,7 @@ func testGetRecoveryInfo(net *lntest.NetworkHarness, t *harnessTest) {
}
// Wait for Carol to sync to the chain.
_, minerHeight, err := net.Miner.Node.GetBestBlock()
_, minerHeight, err := net.Miner.Client.GetBestBlock()
if err != nil {
t.Fatalf("unable to get current blockheight %v", err)
}
@@ -1088,7 +1088,7 @@ func testOnchainFundRecovery(net *lntest.NetworkHarness, t *harnessTest) {
t.Fatalf("unable to send coins to miner: %v", err)
}
txid, err := waitForTxInMempool(
net.Miner.Node, minerMempoolTimeout,
net.Miner.Client, minerMempoolTimeout,
)
if err != nil {
t.Fatalf("transaction not found in mempool: %v", err)
@@ -1536,7 +1536,7 @@ func testUnconfirmedChannelFunding(net *lntest.NetworkHarness, t *harnessTest) {
}
// Make sure the unconfirmed tx is seen in the mempool.
_, err = waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
_, err = waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
if err != nil {
t.Fatalf("failed to find tx in miner mempool: %v", err)
}
@@ -2497,14 +2497,14 @@ func assertMinerBlockHeightDelta(t *harnessTest,
// Ensure the chain lengths are what we expect.
var predErr error
err := wait.Predicate(func() bool {
_, tempMinerHeight, err := tempMiner.Node.GetBestBlock()
_, tempMinerHeight, err := tempMiner.Client.GetBestBlock()
if err != nil {
predErr = fmt.Errorf("unable to get current "+
"blockheight %v", err)
return false
}
_, minerHeight, err := miner.Node.GetBestBlock()
_, minerHeight, err := miner.Client.GetBestBlock()
if err != nil {
predErr = fmt.Errorf("unable to get current "+
"blockheight %v", err)
@@ -2562,7 +2562,7 @@ func testOpenChannelAfterReorg(net *lntest.NetworkHarness, t *harnessTest) {
// We start by connecting the new miner to our original miner,
// such that it will sync to our original chain.
err = net.Miner.Node.Node(
err = net.Miner.Client.Node(
btcjson.NConnect, tempMiner.P2PAddress(), &temp,
)
if err != nil {
@@ -2578,7 +2578,7 @@ func testOpenChannelAfterReorg(net *lntest.NetworkHarness, t *harnessTest) {
// We disconnect the two miners, such that we can mine two different
// chains and can cause a reorg later.
err = net.Miner.Node.Node(
err = net.Miner.Client.Node(
btcjson.NDisconnect, tempMiner.P2PAddress(), &temp,
)
if err != nil {
@@ -2598,7 +2598,7 @@ func testOpenChannelAfterReorg(net *lntest.NetworkHarness, t *harnessTest) {
// Wait for miner to have seen the funding tx. The temporary miner is
// disconnected, and won't see the transaction.
_, err = waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
_, err = waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
if err != nil {
t.Fatalf("failed to find funding tx in mempool: %v", err)
}
@@ -2620,7 +2620,7 @@ func testOpenChannelAfterReorg(net *lntest.NetworkHarness, t *harnessTest) {
// open.
block := mineBlocks(t, net, 10, 1)[0]
assertTxInBlock(t, block, fundingTxID)
if _, err := tempMiner.Node.Generate(15); err != nil {
if _, err := tempMiner.Client.Generate(15); err != nil {
t.Fatalf("unable to generate blocks: %v", err)
}
@@ -2629,7 +2629,7 @@ func testOpenChannelAfterReorg(net *lntest.NetworkHarness, t *harnessTest) {
assertMinerBlockHeightDelta(t, net.Miner, tempMiner, 5)
// Wait for Alice to sync to the original miner's chain.
_, minerHeight, err := net.Miner.Node.GetBestBlock()
_, minerHeight, err := net.Miner.Client.GetBestBlock()
if err != nil {
t.Fatalf("unable to get current blockheight %v", err)
}
@@ -2690,7 +2690,7 @@ func testOpenChannelAfterReorg(net *lntest.NetworkHarness, t *harnessTest) {
// Connecting to the temporary miner should now cause our original
// chain to be re-orged out.
err = net.Miner.Node.Node(
err = net.Miner.Client.Node(
btcjson.NConnect, tempMiner.P2PAddress(), &temp,
)
if err != nil {
@@ -2707,7 +2707,7 @@ func testOpenChannelAfterReorg(net *lntest.NetworkHarness, t *harnessTest) {
// Now we disconnect the two miners, and connect our original miner to
// our chain backend once again.
err = net.Miner.Node.Node(
err = net.Miner.Client.Node(
btcjson.NDisconnect, tempMiner.P2PAddress(), &temp,
)
if err != nil {
@@ -2721,7 +2721,7 @@ func testOpenChannelAfterReorg(net *lntest.NetworkHarness, t *harnessTest) {
// This should have caused a reorg, and Alice should sync to the longer
// chain, where the funding transaction is not confirmed.
_, tempMinerHeight, err := tempMiner.Node.GetBestBlock()
_, tempMinerHeight, err := tempMiner.Client.GetBestBlock()
if err != nil {
t.Fatalf("unable to get current blockheight %v", err)
}
@@ -3001,7 +3001,7 @@ func testChannelFundingPersistence(net *lntest.NetworkHarness, t *harnessTest) {
assertTxInBlock(t, block, fundingTxID)
// Get the height that our transaction confirmed at.
_, height, err := net.Miner.Node.GetBestBlock()
_, height, err := net.Miner.Client.GetBestBlock()
require.NoError(t.t, err, "could not get best block")
// Restart both nodes to test that the appropriate state has been
@@ -3022,7 +3022,7 @@ func testChannelFundingPersistence(net *lntest.NetworkHarness, t *harnessTest) {
// Next, mine enough blocks s.t the channel will open with a single
// additional block mined.
if _, err := net.Miner.Node.Generate(3); err != nil {
if _, err := net.Miner.Client.Generate(3); err != nil {
t.Fatalf("unable to mine blocks: %v", err)
}
@@ -3042,7 +3042,7 @@ func testChannelFundingPersistence(net *lntest.NetworkHarness, t *harnessTest) {
assertNumOpenChannelsPending(ctxt, t, net.Alice, carol, 1)
// Finally, mine the last block which should mark the channel as open.
if _, err := net.Miner.Node.Generate(1); err != nil {
if _, err := net.Miner.Client.Generate(1); err != nil {
t.Fatalf("unable to mine blocks: %v", err)
}
@@ -3699,7 +3699,7 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest,
// Fetch starting height of this test so we can compute the block
// heights we expect certain events to take place.
_, curHeight, err := net.Miner.Node.GetBestBlock()
_, curHeight, err := net.Miner.Client.GetBestBlock()
if err != nil {
t.Fatalf("unable to get best block height")
}
@@ -3807,7 +3807,7 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest,
}
sweepTxns, err := getNTxsFromMempool(
net.Miner.Node, expectedTxes, minerMempoolTimeout,
net.Miner.Client, expectedTxes, minerMempoolTimeout,
)
if err != nil {
t.Fatalf("failed to find commitment in miner mempool: %v", err)
@@ -3819,7 +3819,7 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest,
utx := btcutil.NewTx(tx)
totalWeight += blockchain.GetTransactionWeight(utx)
fee, err := getTxFee(net.Miner.Node, tx)
fee, err := getTxFee(net.Miner.Client, tx)
require.NoError(t.t, err)
totalFee += int64(fee)
}
@@ -3852,7 +3852,7 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest,
}
}
if _, err := net.Miner.Node.Generate(1); err != nil {
if _, err := net.Miner.Client.Generate(1); err != nil {
t.Fatalf("unable to generate block: %v", err)
}
@@ -3921,7 +3921,7 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest,
// not timelocked. If there are anchors, we also expect Carol's anchor
// sweep now.
sweepTxns, err = getNTxsFromMempool(
net.Miner.Node, expectedTxes, minerMempoolTimeout,
net.Miner.Client, expectedTxes, minerMempoolTimeout,
)
if err != nil {
t.Fatalf("failed to find Carol's sweep in miner mempool: %v",
@@ -3953,7 +3953,7 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest,
// For the persistence test, we generate two blocks, then trigger
// a restart and then generate the final block that should trigger
// the creation of the sweep transaction.
if _, err := net.Miner.Node.Generate(defaultCSV - 2); err != nil {
if _, err := net.Miner.Client.Generate(defaultCSV - 2); err != nil {
t.Fatalf("unable to mine blocks: %v", err)
}
@@ -4026,21 +4026,21 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest,
// Generate an additional block, which should cause the CSV delayed
// output from the commitment txn to expire.
if _, err := net.Miner.Node.Generate(1); err != nil {
if _, err := net.Miner.Client.Generate(1); err != nil {
t.Fatalf("unable to mine blocks: %v", err)
}
// At this point, the CSV will expire in the next block, meaning that
// the sweeping transaction should now be broadcast. So we fetch the
// node's mempool to ensure it has been properly broadcast.
sweepingTXID, err := waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
sweepingTXID, err := waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
if err != nil {
t.Fatalf("failed to get sweep tx from mempool: %v", err)
}
// Fetch the sweep transaction, all input it's spending should be from
// the commitment transaction which was broadcast on-chain.
sweepTx, err := net.Miner.Node.GetRawTransaction(sweepingTXID)
sweepTx, err := net.Miner.Client.GetRawTransaction(sweepingTXID)
if err != nil {
t.Fatalf("unable to fetch sweep tx: %v", err)
}
@@ -4091,11 +4091,11 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest,
// Next, we mine an additional block which should include the sweep
// transaction as the input scripts and the sequence locks on the
// inputs should be properly met.
blockHash, err := net.Miner.Node.Generate(1)
blockHash, err := net.Miner.Client.Generate(1)
if err != nil {
t.Fatalf("unable to generate block: %v", err)
}
block, err := net.Miner.Node.GetBlock(blockHash[0])
block, err := net.Miner.Client.GetBlock(blockHash[0])
if err != nil {
t.Fatalf("unable to get block: %v", err)
}
@@ -4103,7 +4103,7 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest,
assertTxInBlock(t, block, sweepTx.Hash())
// Update current height
_, curHeight, err = net.Miner.Node.GetBestBlock()
_, curHeight, err = net.Miner.Client.GetBestBlock()
if err != nil {
t.Fatalf("unable to get best block height")
}
@@ -4167,8 +4167,7 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest,
// Advance the blockchain until just before the CLTV expires, nothing
// exciting should have happened during this time.
blockHash, err = net.Miner.Node.Generate(cltvHeightDelta)
if err != nil {
if _, err := net.Miner.Client.Generate(cltvHeightDelta); err != nil {
t.Fatalf("unable to generate block: %v", err)
}
@@ -4233,8 +4232,7 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest,
// Now, generate the block which will cause Alice to broadcast the
// presigned htlc timeout txns.
blockHash, err = net.Miner.Node.Generate(1)
if err != nil {
if _, err = net.Miner.Client.Generate(1); err != nil {
t.Fatalf("unable to generate block: %v", err)
}
@@ -4250,7 +4248,7 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest,
// Wait for them all to show up in the mempool.
htlcTxIDs, err := waitForNTxsInMempool(
net.Miner.Node, expectedTxes, minerMempoolTimeout,
net.Miner.Client, expectedTxes, minerMempoolTimeout,
)
if err != nil {
t.Fatalf("unable to find htlc timeout txns in mempool: %v", err)
@@ -4279,7 +4277,7 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *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, err := net.Miner.Node.GetRawTransaction(htlcTxID)
htlcTx, err := net.Miner.Client.GetRawTransaction(htlcTxID)
if err != nil {
t.Fatalf("unable to fetch sweep tx: %v", err)
}
@@ -4376,8 +4374,7 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest,
// Generate a block that mines the htlc timeout txns. Doing so now
// activates the 2nd-stage CSV delayed outputs.
blockHash, err = net.Miner.Node.Generate(1)
if err != nil {
if _, err = net.Miner.Client.Generate(1); err != nil {
t.Fatalf("unable to generate block: %v", err)
}
@@ -4395,7 +4392,7 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest,
numBlocks = defaultCSV - 2
}
_, err = net.Miner.Node.Generate(numBlocks)
_, err = net.Miner.Client.Generate(numBlocks)
if err != nil {
t.Fatalf("unable to generate block: %v", err)
}
@@ -4449,21 +4446,20 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest,
// Generate a block that causes Alice to sweep the htlc outputs in the
// kindergarten bucket.
blockHash, err = net.Miner.Node.Generate(1)
if err != nil {
if _, err := net.Miner.Client.Generate(1); err != nil {
t.Fatalf("unable to generate block: %v", err)
}
// Wait for the single sweep txn to appear in the mempool.
htlcSweepTxID, err := waitForTxInMempool(
net.Miner.Node, minerMempoolTimeout,
net.Miner.Client, minerMempoolTimeout,
)
if err != nil {
t.Fatalf("failed to get sweep tx from mempool: %v", err)
}
// Fetch the htlc sweep transaction from the mempool.
htlcSweepTx, err := net.Miner.Node.GetRawTransaction(htlcSweepTxID)
htlcSweepTx, err := net.Miner.Client.GetRawTransaction(htlcSweepTxID)
if err != nil {
t.Fatalf("unable to fetch sweep tx: %v", err)
}
@@ -4650,7 +4646,7 @@ func findCommitAndAnchor(t *harnessTest, net *lntest.NetworkHarness,
for _, tx := range sweepTxns {
txHash := tx.TxHash()
sweepTx, err := net.Miner.Node.GetRawTransaction(&txHash)
sweepTx, err := net.Miner.Client.GetRawTransaction(&txHash)
require.NoError(t.t, err)
// We expect our commitment sweep to have a single input, and,
@@ -5963,7 +5959,7 @@ func testSingleHopSendToRouteCase(net *lntest.NetworkHarness, t *harnessTest,
// 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
// reaches Dave.
_, minerHeight, err := net.Miner.Node.GetBestBlock()
_, minerHeight, err := net.Miner.Client.GetBestBlock()
if err != nil {
t.Fatalf("unable to get best height: %v", err)
}
@@ -8251,26 +8247,26 @@ func testFailingChannel(net *lntest.NetworkHarness, t *harnessTest) {
}
// Carol will use the correct preimage to resolve the HTLC on-chain.
_, err = waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
_, err = waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
if err != nil {
t.Fatalf("unable to find Carol's resolve tx in mempool: %v", err)
}
// Mine enough blocks for Alice to sweep her funds from the force
// closed channel.
_, err = net.Miner.Node.Generate(defaultCSV - 1)
_, err = net.Miner.Client.Generate(defaultCSV - 1)
if err != nil {
t.Fatalf("unable to generate blocks: %v", err)
}
// Wait for the sweeping tx to be broadcast.
_, err = waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
_, err = waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
if err != nil {
t.Fatalf("unable to find Alice's sweep tx in mempool: %v", err)
}
// Mine the sweep.
_, err = net.Miner.Node.Generate(1)
_, err = net.Miner.Client.Generate(1)
if err != nil {
t.Fatalf("unable to generate blocks: %v", err)
}
@@ -8476,7 +8472,7 @@ func testGarbageCollectLinkNodes(net *lntest.NetworkHarness, t *harnessTest) {
// We'll need to mine some blocks in order to mark the channel fully
// closed.
_, err = net.Miner.Node.Generate(chainreg.DefaultBitcoinTimeLockDelta - defaultCSV)
_, err = net.Miner.Client.Generate(chainreg.DefaultBitcoinTimeLockDelta - defaultCSV)
if err != nil {
t.Fatalf("unable to generate blocks: %v", err)
}
@@ -8734,7 +8730,7 @@ func testRevokedCloseRetribution(net *lntest.NetworkHarness, t *harnessTest) {
// Wait for Bob's breach transaction to show up in the mempool to ensure
// that Carol's node has started waiting for confirmations.
_, err = waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
_, err = waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
if err != nil {
t.Fatalf("unable to find Bob's breach tx in mempool: %v", err)
}
@@ -8763,7 +8759,7 @@ func testRevokedCloseRetribution(net *lntest.NetworkHarness, t *harnessTest) {
// Query the mempool for Carol's justice transaction, this should be
// broadcast as Bob's contract breaching transaction gets confirmed
// above.
justiceTXID, err := waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
justiceTXID, err := waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
if err != nil {
t.Fatalf("unable to find Carol's justice tx in mempool: %v", err)
}
@@ -8772,7 +8768,7 @@ func testRevokedCloseRetribution(net *lntest.NetworkHarness, t *harnessTest) {
// Query for the mempool transaction found above. Then assert that all
// the inputs of this transaction are spending outputs generated by
// Bob's breach transaction above.
justiceTx, err := net.Miner.Node.GetRawTransaction(justiceTXID)
justiceTx, err := net.Miner.Client.GetRawTransaction(justiceTXID)
if err != nil {
t.Fatalf("unable to query for justice tx: %v", err)
}
@@ -8988,7 +8984,7 @@ func testRevokedCloseRetributionZeroValueRemoteOutput(net *lntest.NetworkHarness
// Query the mempool for the breaching closing transaction, this should
// be broadcast by Carol when she force closes the channel above.
txid, err := waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
txid, err := waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
if err != nil {
t.Fatalf("unable to find Carol's force close tx in mempool: %v",
err)
@@ -9020,7 +9016,7 @@ func testRevokedCloseRetributionZeroValueRemoteOutput(net *lntest.NetworkHarness
// Query the mempool for Dave's justice transaction, this should be
// broadcast as Carol's contract breaching transaction gets confirmed
// above.
justiceTXID, err := waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
justiceTXID, err := waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
if err != nil {
t.Fatalf("unable to find Dave's justice tx in mempool: %v",
err)
@@ -9030,7 +9026,7 @@ func testRevokedCloseRetributionZeroValueRemoteOutput(net *lntest.NetworkHarness
// 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, err := net.Miner.Node.GetRawTransaction(justiceTXID)
justiceTx, err := net.Miner.Client.GetRawTransaction(justiceTXID)
if err != nil {
t.Fatalf("unable to query for justice tx: %v", err)
}
@@ -9318,7 +9314,7 @@ func testRevokedCloseRetributionRemoteHodl(net *lntest.NetworkHarness,
// Query the mempool for the breaching closing transaction, this should
// be broadcast by Carol when she force closes the channel above.
txid, err := waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
txid, err := waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
if err != nil {
t.Fatalf("unable to find Carol's force close tx in mempool: %v",
err)
@@ -9360,7 +9356,7 @@ func testRevokedCloseRetributionRemoteHodl(net *lntest.NetworkHarness,
var justiceTxid *chainhash.Hash
errNotFound := errors.New("justice tx not found")
findJusticeTx := func() (*chainhash.Hash, error) {
mempool, err := net.Miner.Node.GetRawMempool()
mempool, err := net.Miner.Client.GetRawMempool()
if err != nil {
return nil, fmt.Errorf("unable to get mempool from "+
"miner: %v", err)
@@ -9369,7 +9365,7 @@ func testRevokedCloseRetributionRemoteHodl(net *lntest.NetworkHarness,
for _, txid := range mempool {
// Check that the justice tx has the appropriate number
// of inputs.
tx, err := net.Miner.Node.GetRawTransaction(txid)
tx, err := net.Miner.Client.GetRawTransaction(txid)
if err != nil {
return nil, fmt.Errorf("unable to query for "+
"txs: %v", err)
@@ -9418,7 +9414,7 @@ func testRevokedCloseRetributionRemoteHodl(net *lntest.NetworkHarness,
t.Fatalf(predErr.Error())
}
justiceTx, err := net.Miner.Node.GetRawTransaction(justiceTxid)
justiceTx, err := net.Miner.Client.GetRawTransaction(justiceTxid)
if err != nil {
t.Fatalf("unable to query for justice tx: %v", err)
}
@@ -9426,7 +9422,7 @@ func testRevokedCloseRetributionRemoteHodl(net *lntest.NetworkHarness,
// 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, err := net.Miner.Node.GetRawTransaction(
secondLevel, err := net.Miner.Client.GetRawTransaction(
secondLevelTxid)
if err != nil {
t.Fatalf("unable to query for tx: %v", err)
@@ -9785,7 +9781,7 @@ func testRevokedCloseRetributionAltruistWatchtowerCase(
// Query the mempool for the breaching closing transaction, this should
// be broadcast by Carol when she force closes the channel above.
txid, err := waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
txid, err := waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
if err != nil {
t.Fatalf("unable to find Carol's force close tx in mempool: %v",
err)
@@ -9810,7 +9806,7 @@ func testRevokedCloseRetributionAltruistWatchtowerCase(
// Query the mempool for Dave's justice transaction, this should be
// broadcast as Carol's contract breaching transaction gets confirmed
// above.
justiceTXID, err := waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
justiceTXID, err := waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
if err != nil {
t.Fatalf("unable to find Dave's justice tx in mempool: %v",
err)
@@ -9820,7 +9816,7 @@ func testRevokedCloseRetributionAltruistWatchtowerCase(
// 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, err := net.Miner.Node.GetRawTransaction(justiceTXID)
justiceTx, err := net.Miner.Client.GetRawTransaction(justiceTXID)
if err != nil {
t.Fatalf("unable to query for justice tx: %v", err)
}
@@ -10006,7 +10002,7 @@ func assertDLPExecuted(net *lntest.NetworkHarness, t *harnessTest,
expectedTxes = 2
}
_, err = waitForNTxsInMempool(
net.Miner.Node, expectedTxes, minerMempoolTimeout,
net.Miner.Client, expectedTxes, minerMempoolTimeout,
)
if err != nil {
t.Fatalf("unable to find Carol's force close tx in mempool: %v",
@@ -10035,7 +10031,7 @@ func assertDLPExecuted(net *lntest.NetworkHarness, t *harnessTest,
// We also expect Dave to sweep his anchor, if present.
_, err = waitForNTxsInMempool(
net.Miner.Node, expectedTxes, minerMempoolTimeout,
net.Miner.Client, expectedTxes, minerMempoolTimeout,
)
if err != nil {
t.Fatalf("unable to find Dave's sweep tx in mempool: %v", err)
@@ -10078,7 +10074,7 @@ func assertDLPExecuted(net *lntest.NetworkHarness, t *harnessTest,
// take that into account.
mineBlocks(t, net, defaultCSV-1-1, 0)
carolSweep, err := waitForTxInMempool(
net.Miner.Node, minerMempoolTimeout,
net.Miner.Client, minerMempoolTimeout,
)
if err != nil {
t.Fatalf("unable to find Carol's sweep tx in mempool: %v", err)
@@ -10368,7 +10364,7 @@ func testDataLossProtection(net *lntest.NetworkHarness, t *harnessTest) {
// Mine enough blocks for Carol to sweep her funds.
mineBlocks(t, net, defaultCSV-1, 0)
carolSweep, err := waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
carolSweep, err := waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
if err != nil {
t.Fatalf("unable to find Carol's sweep tx in mempool: %v", err)
}
@@ -10401,7 +10397,7 @@ func testDataLossProtection(net *lntest.NetworkHarness, t *harnessTest) {
}
// Dave should sweep his funds.
_, err = waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
_, err = waitForTxInMempool(net.Miner.Client, minerMempoolTimeout)
if err != nil {
t.Fatalf("unable to find Dave's sweep tx in mempool: %v", err)
}
@@ -10873,7 +10869,7 @@ func testGraphTopologyNtfns(net *lntest.NetworkHarness, t *harnessTest, pinned b
}
}
_, blockHeight, err := net.Miner.Node.GetBestBlock()
_, blockHeight, err := net.Miner.Client.GetBestBlock()
if err != nil {
t.Fatalf("unable to get current blockheight %v", err)
}
@@ -14920,7 +14916,7 @@ func TestLightningNetworkDaemon(t *testing.T) {
// Set up miner and connect chain backend to it.
require.NoError(t, miner.SetUp(true, 50))
require.NoError(t, miner.Node.NotifyNewTransactions(false))
require.NoError(t, miner.Client.NotifyNewTransactions(false))
require.NoError(t, chainBackend.ConnectMiner(), "connect miner")
// Now we can set up our test harness (LND instance), with the chain
@@ -14955,7 +14951,7 @@ func TestLightningNetworkDaemon(t *testing.T) {
// Next mine enough blocks in order for segwit and the CSV package
// soft-fork to activate on SimNet.
numBlocks := harnessNetParams.MinerConfirmationWindow * 2
if _, err := miner.Node.Generate(numBlocks); err != nil {
if _, err := miner.Client.Generate(numBlocks); err != nil {
ht.Fatalf("unable to generate blocks: %v", err)
}
+3 -3
View File
@@ -206,7 +206,7 @@ func mineBlocks(t *harnessTest, net *lntest.NetworkHarness,
var err error
if numTxs > 0 {
txids, err = waitForNTxsInMempool(
net.Miner.Node, numTxs, minerMempoolTimeout,
net.Miner.Client, numTxs, minerMempoolTimeout,
)
if err != nil {
t.Fatalf("unable to find txns in mempool: %v", err)
@@ -215,13 +215,13 @@ func mineBlocks(t *harnessTest, net *lntest.NetworkHarness,
blocks := make([]*wire.MsgBlock, num)
blockHashes, err := net.Miner.Node.Generate(num)
blockHashes, err := net.Miner.Client.Generate(num)
if err != nil {
t.Fatalf("unable to generate blocks: %v", err)
}
for i, blockHash := range blockHashes {
block, err := net.Miner.Node.GetBlock(blockHash)
block, err := net.Miner.Client.GetBlock(blockHash)
if err != nil {
t.Fatalf("unable to get block: %v", err)
}