From 9d1d6290010406d7a34fa2d0169e9a500e798a6a Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Fri, 12 Aug 2022 17:03:44 +0800 Subject: [PATCH] itest+lntest: migrate `lntemp` to `lntest` This commit performs the takeover that `lntemp` is now promoted to be `lntest`, and the scaffolding is now removed as all the refactoring is finished! --- itest/list_off_test.go | 4 +- itest/list_on_test.go | 4 +- itest/lnd_amp_test.go | 16 ++-- itest/lnd_channel_backup_test.go | 74 +++++++++---------- itest/lnd_channel_balance_test.go | 22 +++--- itest/lnd_channel_force_close_test.go | 28 +++---- itest/lnd_channel_graph_test.go | 34 ++++----- itest/lnd_channel_policy_test.go | 34 ++++----- itest/lnd_custom_message.go | 8 +- itest/lnd_etcd_failover_test.go | 12 +-- itest/lnd_forward_interceptor_test.go | 20 ++--- itest/lnd_funding_test.go | 53 +++++++------ itest/lnd_hold_invoice_force_test.go | 6 +- itest/lnd_hold_persistence_test.go | 10 +-- itest/lnd_macaroons_test.go | 12 +-- itest/lnd_max_channel_size_test.go | 8 +- itest/lnd_max_htlcs_test.go | 12 +-- itest/lnd_misc_test.go | 58 +++++++-------- itest/lnd_mpp_test.go | 24 +++--- itest/lnd_multi-hop-error-propagation_test.go | 44 +++++------ itest/lnd_multi-hop-payments_test.go | 16 ++-- itest/lnd_multi-hop_test.go | 64 ++++++++-------- itest/lnd_network_test.go | 12 +-- itest/lnd_neutrino_test.go | 4 +- itest/lnd_no_etcd_dummy_failover_test.go | 4 +- itest/lnd_nonstd_sweep_test.go | 6 +- itest/lnd_onchain_test.go | 38 +++++----- itest/lnd_open_channel_test.go | 32 ++++---- itest/lnd_payment_test.go | 32 ++++---- itest/lnd_psbt_test.go | 48 ++++++------ itest/lnd_recovery_test.go | 10 +-- itest/lnd_remote_signer_test.go | 32 ++++---- itest/lnd_res_handoff_test.go | 6 +- itest/lnd_rest_api_test.go | 18 ++--- itest/lnd_revocation_test.go | 24 +++--- itest/lnd_routing_test.go | 74 +++++++++---------- itest/lnd_rpc_middleware_interceptor_test.go | 10 +-- itest/lnd_send_multi_path_payment_test.go | 4 +- itest/lnd_signer_test.go | 18 ++--- itest/lnd_single_hop_invoice_test.go | 6 +- itest/lnd_switch_test.go | 24 +++--- itest/lnd_taproot_test.go | 54 +++++++------- itest/lnd_test.go | 10 +-- itest/lnd_trackpayments_test.go | 6 +- itest/lnd_wallet_import_test.go | 30 ++++---- itest/lnd_wipe_fwdpkgs_test.go | 8 +- itest/lnd_wumbo_channels_test.go | 8 +- itest/lnd_zero_conf_test.go | 48 ++++++------ {lntemp => lntest}/README.md | 0 lntest/bitcoind_common.go | 2 +- lntest/btcd.go | 2 +- {lntemp => lntest}/fee_service.go | 4 +- {lntemp => lntest}/harness.go | 6 +- {lntemp => lntest}/harness_assertion.go | 6 +- {lntemp => lntest}/harness_miner.go | 4 +- {lntemp => lntest}/harness_node_manager.go | 4 +- {lntemp => lntest}/harness_setup.go | 7 +- lntest/neutrino.go | 2 +- {lntemp => lntest}/node/config.go | 0 {lntemp => lntest}/node/harness_node.go | 2 +- {lntemp => lntest}/node/state.go | 2 +- {lntemp => lntest}/node/watcher.go | 2 +- {lntemp => lntest}/rpc/chain_kit.go | 0 {lntemp => lntest}/rpc/chain_notifier.go | 0 {lntemp => lntest}/rpc/harness_rpc.go | 0 {lntemp => lntest}/rpc/invoices.go | 0 {lntemp => lntest}/rpc/lnd.go | 0 {lntemp => lntest}/rpc/neutrino_kit.go | 0 {lntemp => lntest}/rpc/peers.go | 0 {lntemp => lntest}/rpc/router.go | 0 {lntemp => lntest}/rpc/signer.go | 0 {lntemp => lntest}/rpc/state.go | 0 {lntemp => lntest}/rpc/wallet_kit.go | 0 {lntemp => lntest}/rpc/wallet_unlocker.go | 0 {lntemp => lntest}/rpc/watchtower.go | 0 {lntemp => lntest}/utils.go | 2 +- 76 files changed, 590 insertions(+), 584 deletions(-) rename {lntemp => lntest}/README.md (100%) rename {lntemp => lntest}/fee_service.go (98%) rename {lntemp => lntest}/harness.go (99%) rename {lntemp => lntest}/harness_assertion.go (99%) rename {lntemp => lntest}/harness_miner.go (99%) rename {lntemp => lntest}/harness_node_manager.go (99%) rename {lntemp => lntest}/harness_setup.go (95%) rename {lntemp => lntest}/node/config.go (100%) rename {lntemp => lntest}/node/harness_node.go (99%) rename {lntemp => lntest}/node/state.go (99%) rename {lntemp => lntest}/node/watcher.go (99%) rename {lntemp => lntest}/rpc/chain_kit.go (100%) rename {lntemp => lntest}/rpc/chain_notifier.go (100%) rename {lntemp => lntest}/rpc/harness_rpc.go (100%) rename {lntemp => lntest}/rpc/invoices.go (100%) rename {lntemp => lntest}/rpc/lnd.go (100%) rename {lntemp => lntest}/rpc/neutrino_kit.go (100%) rename {lntemp => lntest}/rpc/peers.go (100%) rename {lntemp => lntest}/rpc/router.go (100%) rename {lntemp => lntest}/rpc/signer.go (100%) rename {lntemp => lntest}/rpc/state.go (100%) rename {lntemp => lntest}/rpc/wallet_kit.go (100%) rename {lntemp => lntest}/rpc/wallet_unlocker.go (100%) rename {lntemp => lntest}/rpc/watchtower.go (100%) rename {lntemp => lntest}/utils.go (99%) diff --git a/itest/list_off_test.go b/itest/list_off_test.go index bb54b2546..a510747e8 100644 --- a/itest/list_off_test.go +++ b/itest/list_off_test.go @@ -2,6 +2,6 @@ package itest -import "github.com/lightningnetwork/lnd/lntemp" +import "github.com/lightningnetwork/lnd/lntest" -var allTestCases = []*lntemp.TestCase{} +var allTestCases = []*lntest.TestCase{} diff --git a/itest/list_on_test.go b/itest/list_on_test.go index 4572a94f1..4a9b2baec 100644 --- a/itest/list_on_test.go +++ b/itest/list_on_test.go @@ -2,9 +2,9 @@ package itest -import "github.com/lightningnetwork/lnd/lntemp" +import "github.com/lightningnetwork/lnd/lntest" -var allTestCases = []*lntemp.TestCase{ +var allTestCases = []*lntest.TestCase{ { Name: "update channel status", TestFunc: testUpdateChanStatus, diff --git a/itest/lnd_amp_test.go b/itest/lnd_amp_test.go index 46dddbd08..a76aedd99 100644 --- a/itest/lnd_amp_test.go +++ b/itest/lnd_amp_test.go @@ -11,15 +11,15 @@ import ( "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/invoicesrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/lntypes" "github.com/stretchr/testify/require" ) // testSendPaymentAMPInvoice tests that we can send an AMP payment to a // specified AMP invoice using SendPaymentV2. -func testSendPaymentAMPInvoice(ht *lntemp.HarnessTest) { +func testSendPaymentAMPInvoice(ht *lntest.HarnessTest) { succeed := ht.Run("native payaddr", func(t *testing.T) { tt := ht.Subtest(t) testSendPaymentAMPInvoiceCase(tt, false) @@ -36,7 +36,7 @@ func testSendPaymentAMPInvoice(ht *lntemp.HarnessTest) { }) } -func testSendPaymentAMPInvoiceCase(ht *lntemp.HarnessTest, +func testSendPaymentAMPInvoiceCase(ht *lntest.HarnessTest, useExternalPayAddr bool) { mts := newMppTestScenario(ht) @@ -196,7 +196,7 @@ func testSendPaymentAMPInvoiceCase(ht *lntemp.HarnessTest, // testSendPaymentAMPInvoiceRepeat tests that it's possible to pay an AMP // invoice multiple times by having the client generate a new setID each time. -func testSendPaymentAMPInvoiceRepeat(ht *lntemp.HarnessTest) { +func testSendPaymentAMPInvoiceRepeat(ht *lntest.HarnessTest) { // In this basic test, we'll only need two nodes as we want to // primarily test the recurring payment feature. So we'll re-use the carol := ht.NewNode("Carol", nil) @@ -218,7 +218,7 @@ func testSendPaymentAMPInvoiceRepeat(ht *lntemp.HarnessTest) { // Establish a channel between Carol and Dave. chanAmt := btcutil.Amount(100_000) ht.OpenChannel( - carol, dave, lntemp.OpenChannelParams{Amt: chanAmt}, + carol, dave, lntest.OpenChannelParams{Amt: chanAmt}, ) // Create an AMP invoice of a trivial amount, that we'll pay repeatedly @@ -353,7 +353,7 @@ func testSendPaymentAMPInvoiceRepeat(ht *lntemp.HarnessTest) { // testSendPaymentAMP tests that we can send an AMP payment to a specified // destination using SendPaymentV2. -func testSendPaymentAMP(ht *lntemp.HarnessTest) { +func testSendPaymentAMP(ht *lntest.HarnessTest) { mts := newMppTestScenario(ht) const paymentAmt = btcutil.Amount(300000) @@ -460,7 +460,7 @@ func testSendPaymentAMP(ht *lntemp.HarnessTest) { mts.closeChannels() } -func testSendToRouteAMP(ht *lntemp.HarnessTest) { +func testSendToRouteAMP(ht *lntest.HarnessTest) { mts := newMppTestScenario(ht) const ( paymentAmt = btcutil.Amount(300000) diff --git a/itest/lnd_channel_backup_test.go b/itest/lnd_channel_backup_test.go index 58ebc949e..acd4b9c5b 100644 --- a/itest/lnd_channel_backup_test.go +++ b/itest/lnd_channel_backup_test.go @@ -18,8 +18,8 @@ import ( "github.com/lightningnetwork/lnd/funding" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/walletrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/lntest/wait" "github.com/stretchr/testify/require" ) @@ -34,7 +34,7 @@ type ( // that'll return the same node, but with its state restored via a // custom method. We use this to abstract away _how_ a node is restored // from our assertions once the node has been fully restored itself. - restoreMethodType func(ht *lntemp.HarnessTest, + restoreMethodType func(ht *lntest.HarnessTest, oldNode *node.HarnessNode, backupFilePath string, password []byte, mnemonic []string) nodeRestorer ) @@ -50,12 +50,12 @@ type chanRestoreScenario struct { dave *node.HarnessNode password []byte mnemonic []string - params lntemp.OpenChannelParams + params lntest.OpenChannelParams } // newChanRestoreScenario creates a new scenario that has two nodes, Carol and // Dave, connected and funded. -func newChanRestoreScenario(ht *lntemp.HarnessTest, ct lnrpc.CommitmentType, +func newChanRestoreScenario(ht *lntest.HarnessTest, ct lnrpc.CommitmentType, zeroConf bool) *chanRestoreScenario { const ( @@ -70,7 +70,7 @@ func newChanRestoreScenario(ht *lntemp.HarnessTest, ct lnrpc.CommitmentType, } if ct != lnrpc.CommitmentType_UNKNOWN_COMMITMENT_TYPE { - args := lntemp.NodeArgsForCommitType(ct) + args := lntest.NodeArgsForCommitType(ct) nodeArgs = append(nodeArgs, args...) } @@ -99,7 +99,7 @@ func newChanRestoreScenario(ht *lntemp.HarnessTest, ct lnrpc.CommitmentType, // For the anchor output case we need two UTXOs for Carol so she can // sweep both the local and remote anchor. - if lntemp.CommitTypeHasAnchors(ct) { + if lntest.CommitTypeHasAnchors(ct) { ht.FundCoins(btcutil.SatoshiPerBitcoin, carol) } @@ -112,7 +112,7 @@ func newChanRestoreScenario(ht *lntemp.HarnessTest, ct lnrpc.CommitmentType, dave: dave, mnemonic: mnemonic, password: password, - params: lntemp.OpenChannelParams{ + params: lntest.OpenChannelParams{ Amt: chanAmt, PushAmt: pushAmt, ZeroConf: zeroConf, @@ -123,7 +123,7 @@ func newChanRestoreScenario(ht *lntemp.HarnessTest, ct lnrpc.CommitmentType, // restoreDave will call the `nodeRestorer` and asserts Dave is restored by // checking his wallet balance against zero. -func (c *chanRestoreScenario) restoreDave(ht *lntemp.HarnessTest, +func (c *chanRestoreScenario) restoreDave(ht *lntest.HarnessTest, restoredNodeFunc nodeRestorer) *node.HarnessNode { // Next, we'll make a new Dave and start the bulk of our recovery @@ -154,7 +154,7 @@ func (c *chanRestoreScenario) restoreDave(ht *lntemp.HarnessTest, // 4. validate pending channel state and check we cannot force close it. // 5. validate Carol's UTXOs. // 6. assert DLP is executed. -func (c *chanRestoreScenario) testScenario(ht *lntemp.HarnessTest, +func (c *chanRestoreScenario) testScenario(ht *lntest.HarnessTest, restoredNodeFunc nodeRestorer) { carol, dave := c.carol, c.dave @@ -212,7 +212,7 @@ func (c *chanRestoreScenario) testScenario(ht *lntemp.HarnessTest, // let's start up Carol again. require.NoError(ht, restartCarol(), "restart carol failed") - if lntemp.CommitTypeHasAnchors(c.params.CommitmentType) { + if lntest.CommitTypeHasAnchors(c.params.CommitmentType) { ht.AssertNumUTXOs(carol, 2) } else { ht.AssertNumUTXOs(carol, 1) @@ -232,7 +232,7 @@ func (c *chanRestoreScenario) testScenario(ht *lntemp.HarnessTest, // restoring from initial wallet creation. We'll also alternate between // restoring form the on disk file, and restoring from the exported RPC command // as well. -func testChannelBackupRestoreBasic(ht *lntemp.HarnessTest) { +func testChannelBackupRestoreBasic(ht *lntest.HarnessTest) { var testCases = []struct { name string restoreMethod restoreMethodType @@ -241,7 +241,7 @@ func testChannelBackupRestoreBasic(ht *lntemp.HarnessTest) { // was the initiator, of the non-advertised channel. { name: "restore from RPC backup", - restoreMethod: func(st *lntemp.HarnessTest, + restoreMethod: func(st *lntest.HarnessTest, oldNode *node.HarnessNode, backupFilePath string, password []byte, @@ -269,7 +269,7 @@ func testChannelBackupRestoreBasic(ht *lntemp.HarnessTest) { // interface. { name: "restore from backup file", - restoreMethod: func(st *lntemp.HarnessTest, + restoreMethod: func(st *lntest.HarnessTest, oldNode *node.HarnessNode, backupFilePath string, password []byte, @@ -293,7 +293,7 @@ func testChannelBackupRestoreBasic(ht *lntemp.HarnessTest) { // prior mnemonic and new backup seed. { name: "restore during creation", - restoreMethod: func(st *lntemp.HarnessTest, + restoreMethod: func(st *lntest.HarnessTest, oldNode *node.HarnessNode, backupFilePath string, password []byte, @@ -325,7 +325,7 @@ func testChannelBackupRestoreBasic(ht *lntemp.HarnessTest) { // re-created, using the Unlock call. { name: "restore during unlock", - restoreMethod: func(st *lntemp.HarnessTest, + restoreMethod: func(st *lntest.HarnessTest, oldNode *node.HarnessNode, backupFilePath string, password []byte, @@ -362,7 +362,7 @@ func testChannelBackupRestoreBasic(ht *lntemp.HarnessTest) { // make sure imports can be canceled and later resumed. { name: "restore from backup file twice", - restoreMethod: func(st *lntemp.HarnessTest, + restoreMethod: func(st *lntest.HarnessTest, oldNode *node.HarnessNode, backupFilePath string, password []byte, @@ -420,7 +420,7 @@ func testChannelBackupRestoreBasic(ht *lntemp.HarnessTest) { // ensuring that after Dave restores his channel state according to the // testCase, the DLP protocol is executed properly and both nodes are made // whole. -func runChanRestoreScenarioBasic(ht *lntemp.HarnessTest, +func runChanRestoreScenarioBasic(ht *lntest.HarnessTest, restoreMethod restoreMethodType) { // Create a new retore scenario. @@ -445,7 +445,7 @@ func runChanRestoreScenarioBasic(ht *lntemp.HarnessTest, // testChannelBackupRestoreUnconfirmed tests that we're able to restore from // disk file and the exported RPC command for unconfirmed channel. -func testChannelBackupRestoreUnconfirmed(ht *lntemp.HarnessTest) { +func testChannelBackupRestoreUnconfirmed(ht *lntest.HarnessTest) { // Use the channel backup file that contains an unconfirmed channel and // make sure recovery works as well. ht.Run("restore unconfirmed channel file", func(t *testing.T) { @@ -463,7 +463,7 @@ func testChannelBackupRestoreUnconfirmed(ht *lntemp.HarnessTest) { // runChanRestoreScenarioUnConfirmed checks that Dave is able to restore for an // unconfirmed channel. -func runChanRestoreScenarioUnConfirmed(ht *lntemp.HarnessTest, useFile bool) { +func runChanRestoreScenarioUnConfirmed(ht *lntest.HarnessTest, useFile bool) { // Create a new retore scenario. crs := newChanRestoreScenario( ht, lnrpc.CommitmentType_UNKNOWN_COMMITMENT_TYPE, false, @@ -527,7 +527,7 @@ func runChanRestoreScenarioUnConfirmed(ht *lntemp.HarnessTest, useFile bool) { // testChannelBackupRestoreCommitTypes tests that we're able to recover from, // and initiate the DLP protocol for different channel commitment types and // zero-conf channel. -func testChannelBackupRestoreCommitTypes(ht *lntemp.HarnessTest) { +func testChannelBackupRestoreCommitTypes(ht *lntest.HarnessTest) { var testCases = []struct { name string ct lnrpc.CommitmentType @@ -584,7 +584,7 @@ func testChannelBackupRestoreCommitTypes(ht *lntemp.HarnessTest) { // runChanRestoreScenarioCommitTypes tests that the DLP is applied for // different channel commitment types and zero-conf channel. -func runChanRestoreScenarioCommitTypes(ht *lntemp.HarnessTest, +func runChanRestoreScenarioCommitTypes(ht *lntest.HarnessTest, ct lnrpc.CommitmentType, zeroConf bool) { // Create a new retore scenario. @@ -639,7 +639,7 @@ func runChanRestoreScenarioCommitTypes(ht *lntemp.HarnessTest, // testChannelBackupRestoreLegacy checks a channel with the legacy revocation // producer format and makes sure old SCBs can still be recovered. -func testChannelBackupRestoreLegacy(ht *lntemp.HarnessTest) { +func testChannelBackupRestoreLegacy(ht *lntest.HarnessTest) { // Create a new retore scenario. crs := newChanRestoreScenario( ht, lnrpc.CommitmentType_UNKNOWN_COMMITMENT_TYPE, false, @@ -668,7 +668,7 @@ func testChannelBackupRestoreLegacy(ht *lntemp.HarnessTest) { // testChannelBackupRestoreForceClose checks that Dave can restore from force // closed channels. -func testChannelBackupRestoreForceClose(ht *lntemp.HarnessTest) { +func testChannelBackupRestoreForceClose(ht *lntest.HarnessTest) { // Restore a channel that was force closed by dave just before going // offline. success := ht.Run("from backup file anchors", func(t *testing.T) { @@ -691,7 +691,7 @@ func testChannelBackupRestoreForceClose(ht *lntemp.HarnessTest) { // runChanRestoreScenarioForceClose creates anchor-enabled force close channels // and checks that Dave is able to restore from them. -func runChanRestoreScenarioForceClose(ht *lntemp.HarnessTest, zeroConf bool) { +func runChanRestoreScenarioForceClose(ht *lntest.HarnessTest, zeroConf bool) { crs := newChanRestoreScenario( ht, lnrpc.CommitmentType_ANCHORS, zeroConf, ) @@ -792,7 +792,7 @@ func runChanRestoreScenarioForceClose(ht *lntemp.HarnessTest, zeroConf bool) { // testChannelBackupUpdates tests that both the streaming channel update RPC, // and the on-disk channel.backup are updated each time a channel is // opened/closed. -func testChannelBackupUpdates(ht *lntemp.HarnessTest) { +func testChannelBackupUpdates(ht *lntest.HarnessTest) { alice := ht.Alice // First, we'll make a temp directory that we'll use to store our @@ -850,7 +850,7 @@ func testChannelBackupUpdates(ht *lntemp.HarnessTest) { chanAmt := btcutil.Amount(1000000) for i := 0; i < numChans; i++ { chanPoint := ht.OpenChannel( - alice, carol, lntemp.OpenChannelParams{Amt: chanAmt}, + alice, carol, lntest.OpenChannelParams{Amt: chanAmt}, ) chanPoints = append(chanPoints, chanPoint) } @@ -962,7 +962,7 @@ func testChannelBackupUpdates(ht *lntemp.HarnessTest) { // testExportChannelBackup tests that we're able to properly export either a // targeted channel's backup, or export backups of all the currents open // channels. -func testExportChannelBackup(ht *lntemp.HarnessTest) { +func testExportChannelBackup(ht *lntest.HarnessTest) { // First, we'll create our primary test node: Carol. We'll use Carol to // open channels and also export backups that we'll examine throughout // the test. @@ -979,7 +979,7 @@ func testExportChannelBackup(ht *lntemp.HarnessTest) { chanAmt := btcutil.Amount(1000000) for i := 0; i < numChans; i++ { chanPoint := ht.OpenChannel( - alice, carol, lntemp.OpenChannelParams{Amt: chanAmt}, + alice, carol, lntest.OpenChannelParams{Amt: chanAmt}, ) chanPoints = append(chanPoints, chanPoint) } @@ -1086,7 +1086,7 @@ func testExportChannelBackup(ht *lntemp.HarnessTest) { // relationship lost state, they will detect this during channel sync, and the // up-to-date party will force close the channel, giving the outdated party the // opportunity to sweep its output. -func testDataLossProtection(ht *lntemp.HarnessTest) { +func testDataLossProtection(ht *lntest.HarnessTest) { const ( chanAmt = funding.MaxBtcFundingAmount paymentAmt = 10000 @@ -1122,7 +1122,7 @@ func testDataLossProtection(ht *lntemp.HarnessTest) { // We'll first open up a channel between them with a 0.5 BTC // value. chanPoint := ht.OpenChannel( - carol, node, lntemp.OpenChannelParams{ + carol, node, lntest.OpenChannelParams{ Amt: chanAmt, }, ) @@ -1255,7 +1255,7 @@ func testDataLossProtection(ht *lntemp.HarnessTest) { // createLegacyRevocationChannel creates a single channel using the legacy // revocation producer format by using PSBT to signal a special pending channel // ID. -func createLegacyRevocationChannel(ht *lntemp.HarnessTest, +func createLegacyRevocationChannel(ht *lntest.HarnessTest, chanAmt, pushAmt btcutil.Amount, from, to *node.HarnessNode) { // We'll signal to the wallet that we also want to create a channel @@ -1277,7 +1277,7 @@ func createLegacyRevocationChannel(ht *lntemp.HarnessTest, }, }, } - openChannelReq := lntemp.OpenChannelParams{ + openChannelReq := lntest.OpenChannelParams{ Amt: chanAmt, PushAmt: pushAmt, FundingShim: shim, @@ -1345,7 +1345,7 @@ func createLegacyRevocationChannel(ht *lntemp.HarnessTest, // chanRestoreViaRPC is a helper test method that returns a nodeRestorer // instance which will restore the target node from a password+seed, then // trigger a SCB restore using the RPC interface. -func chanRestoreViaRPC(ht *lntemp.HarnessTest, password []byte, +func chanRestoreViaRPC(ht *lntest.HarnessTest, password []byte, mnemonic []string, multi []byte, oldNode *node.HarnessNode) nodeRestorer { @@ -1382,7 +1382,7 @@ func copyPorts(oldNode *node.HarnessNode) node.Option { // // Note: this function is only used in this test file and has been made // specifically for testChanRestoreScenario. -func assertTimeLockSwept(ht *lntemp.HarnessTest, carol, dave *node.HarnessNode, +func assertTimeLockSwept(ht *lntest.HarnessTest, carol, dave *node.HarnessNode, carolStartingBalance, daveStartingBalance int64) { // We expect Carol to sweep her funds and also the anchor tx. @@ -1450,7 +1450,7 @@ func assertTimeLockSwept(ht *lntemp.HarnessTest, carol, dave *node.HarnessNode, // funds immediately, and Carol sweeping her fund after her CSV delay is up. If // the blankSlate value is true, then this means that Dave won't need to sweep // on chain as he has no funds in the channel. -func assertDLPExecuted(ht *lntemp.HarnessTest, +func assertDLPExecuted(ht *lntest.HarnessTest, carol *node.HarnessNode, carolStartingBalance int64, dave *node.HarnessNode, daveStartingBalance int64, commitType lnrpc.CommitmentType) { @@ -1467,7 +1467,7 @@ func assertDLPExecuted(ht *lntemp.HarnessTest, // Upon reconnection, the nodes should detect that Dave is out of sync. // Carol should force close the channel using her latest commitment. expectedTxes := 1 - if lntemp.CommitTypeHasAnchors(commitType) { + if lntest.CommitTypeHasAnchors(commitType) { expectedTxes = 2 } ht.Miner.AssertNumTxsInMempool(expectedTxes) diff --git a/itest/lnd_channel_balance_test.go b/itest/lnd_channel_balance_test.go index d54258e11..72dd16ea3 100644 --- a/itest/lnd_channel_balance_test.go +++ b/itest/lnd_channel_balance_test.go @@ -7,8 +7,8 @@ import ( "github.com/lightningnetwork/lnd/funding" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/lntest/wait" "github.com/lightningnetwork/lnd/lnwire" "github.com/stretchr/testify/require" @@ -16,7 +16,7 @@ import ( // testChannelBalance creates a new channel between Alice and Bob, then checks // channel balance to be equal amount specified while creation of channel. -func testChannelBalance(ht *lntemp.HarnessTest) { +func testChannelBalance(ht *lntest.HarnessTest) { // Open a channel with 0.16 BTC between Alice and Bob, ensuring the // channel has been opened properly. amount := funding.MaxBtcFundingAmount @@ -52,16 +52,16 @@ func testChannelBalance(ht *lntemp.HarnessTest) { ht.EnsureConnected(alice, bob) chanPoint := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{Amt: amount}, + alice, bob, lntest.OpenChannelParams{Amt: amount}, ) cType := ht.GetChannelCommitType(alice, chanPoint) // As this is a single funder channel, Alice's balance should be // exactly 0.5 BTC since now state transitions have taken place yet. - checkChannelBalance(alice, amount-lntemp.CalcStaticFee(cType, 0), 0) + checkChannelBalance(alice, amount-lntest.CalcStaticFee(cType, 0), 0) // Ensure Bob currently has no available balance within the channel. - checkChannelBalance(bob, 0, amount-lntemp.CalcStaticFee(cType, 0)) + checkChannelBalance(bob, 0, amount-lntest.CalcStaticFee(cType, 0)) // Finally close the channel between Alice and Bob, asserting that the // channel has been properly closed on-chain. @@ -73,7 +73,7 @@ func testChannelBalance(ht *lntemp.HarnessTest) { // Alice will send Htlcs to Carol while she is in hodl mode. This will result // in a build of pending Htlcs. We expect the channels unsettled balance to // equal the sum of all the Pending Htlcs. -func testChannelUnsettledBalance(ht *lntemp.HarnessTest) { +func testChannelUnsettledBalance(ht *lntest.HarnessTest) { const chanAmt = btcutil.Amount(1000000) // Creates a helper closure to be used below which asserts the proper @@ -123,20 +123,20 @@ func testChannelUnsettledBalance(ht *lntemp.HarnessTest) { // Open a channel between Alice and Carol. chanPointAlice := ht.OpenChannel( - alice, carol, lntemp.OpenChannelParams{Amt: chanAmt}, + alice, carol, lntest.OpenChannelParams{Amt: chanAmt}, ) cType := ht.GetChannelCommitType(alice, chanPointAlice) // Check alice's channel balance, which should have zero remote and zero // pending balance. checkChannelBalance( - alice, chanAmt-lntemp.CalcStaticFee(cType, 0), 0, 0, 0, + alice, chanAmt-lntest.CalcStaticFee(cType, 0), 0, 0, 0, ) // Check carol's channel balance, which should have zero local and zero // pending balance. checkChannelBalance( - carol, 0, chanAmt-lntemp.CalcStaticFee(cType, 0), 0, 0, + carol, 0, chanAmt-lntest.CalcStaticFee(cType, 0), 0, 0, ) // Channel should be ready for payments. @@ -199,7 +199,7 @@ func testChannelUnsettledBalance(ht *lntemp.HarnessTest) { // Check alice's channel balance, which should have a remote unsettled // balance that equals to the amount of invoices * payAmt. The remote // balance remains zero. - fee := lntemp.CalcStaticFee(cType, 0) + fee := lntest.CalcStaticFee(cType, 0) aliceLocal := chanAmt - fee - numInvoices*payAmt checkChannelBalance(alice, aliceLocal, 0, 0, numInvoices*payAmt) diff --git a/itest/lnd_channel_force_close_test.go b/itest/lnd_channel_force_close_test.go index 8db63cb1a..f7b77ec88 100644 --- a/itest/lnd_channel_force_close_test.go +++ b/itest/lnd_channel_force_close_test.go @@ -13,8 +13,8 @@ import ( "github.com/lightningnetwork/lnd/chainreg" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/lntest/wait" "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/lnwallet/chainfee" @@ -30,7 +30,7 @@ import ( // // Note that whether the deadline is used or not is implicitly checked by its // corresponding fee rates. -func testCommitmentTransactionDeadline(ht *lntemp.HarnessTest) { +func testCommitmentTransactionDeadline(ht *lntest.HarnessTest) { // Get the default max fee rate used in sweeping the commitment // transaction. defaultMax := lnwallet.DefaultAnchorsCommitMaxFeeRateSatPerVByte @@ -72,7 +72,7 @@ func testCommitmentTransactionDeadline(ht *lntemp.HarnessTest) { setupNode := func(name string) *node.HarnessNode { // Create the node. args := []string{"--hodl.exit-settle"} - args = append(args, lntemp.NodeArgsForCommitType( + args = append(args, lntest.NodeArgsForCommitType( lnrpc.CommitmentType_ANCHORS)..., ) node := ht.NewNode(name, args) @@ -104,7 +104,7 @@ func testCommitmentTransactionDeadline(ht *lntemp.HarnessTest) { // Open a channel between Alice and Bob. chanPoint := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{ + alice, bob, lntest.OpenChannelParams{ Amt: 10e6, PushAmt: 5e6, }, @@ -194,7 +194,7 @@ func testCommitmentTransactionDeadline(ht *lntemp.HarnessTest) { // process. // // TODO(roasbeef): also add an unsettled HTLC before force closing. -func testChannelForceClosure(ht *lntemp.HarnessTest) { +func testChannelForceClosure(ht *lntest.HarnessTest) { // We'll test the scenario for some of the commitment types, to ensure // outputs can be swept. commitTypes := []lnrpc.CommitmentType{ @@ -209,7 +209,7 @@ func testChannelForceClosure(ht *lntemp.HarnessTest) { success := ht.Run(testName, func(t *testing.T) { st := ht.Subtest(t) - args := lntemp.NodeArgsForCommitType(channelType) + args := lntest.NodeArgsForCommitType(channelType) alice := st.NewNode("Alice", args) defer st.Shutdown(alice) @@ -237,7 +237,7 @@ func testChannelForceClosure(ht *lntemp.HarnessTest) { } } -func channelForceClosureTest(ht *lntemp.HarnessTest, +func channelForceClosureTest(ht *lntest.HarnessTest, alice, carol *node.HarnessNode, channelType lnrpc.CommitmentType) { const ( @@ -268,7 +268,7 @@ func channelForceClosureTest(ht *lntemp.HarnessTest, carolStartingBalance := carolBalResp.ConfirmedBalance chanPoint := ht.OpenChannel( - alice, carol, lntemp.OpenChannelParams{ + alice, carol, lntest.OpenChannelParams{ Amt: chanAmt, PushAmt: pushAmt, }, @@ -600,6 +600,8 @@ func channelForceClosureTest(ht *lntemp.HarnessTest, // Update current height _, curHeight = ht.Miner.GetBestBlock() + // checkForceClosedChannelNumHtlcs verifies that a force closed channel + // has the proper number of htlcs. err = wait.NoError(func() error { // Now that the commit output has been fully swept, check to // see that the channel remains open for the pending htlc @@ -986,7 +988,7 @@ func padCLTV(cltv uint32) uint32 { // testFailingChannel tests that we will fail the channel by force closing it // in the case where a counterparty tries to settle an HTLC with the wrong // preimage. -func testFailingChannel(ht *lntemp.HarnessTest) { +func testFailingChannel(ht *lntest.HarnessTest) { const paymentAmt = 10000 chanAmt := lnd.MaxFundingAmount @@ -999,7 +1001,7 @@ func testFailingChannel(ht *lntemp.HarnessTest) { ht.ConnectNodes(alice, carol) // Let Alice connect and open a channel to Carol, - ht.OpenChannel(alice, carol, lntemp.OpenChannelParams{Amt: chanAmt}) + ht.OpenChannel(alice, carol, lntest.OpenChannelParams{Amt: chanAmt}) // With the channel open, we'll create a invoice for Carol that Alice // will attempt to pay. @@ -1058,7 +1060,7 @@ func testFailingChannel(ht *lntemp.HarnessTest) { // type matches a set of expected resolutions. // // NOTE: only used in current test file. -func assertReports(ht *lntemp.HarnessTest, hn *node.HarnessNode, +func assertReports(ht *lntest.HarnessTest, hn *node.HarnessNode, chanPoint *lnrpc.ChannelPoint, expected map[string]*lnrpc.Resolution) { op := ht.OutPointFromChannelPoint(chanPoint) @@ -1092,7 +1094,7 @@ func assertReports(ht *lntemp.HarnessTest, hn *node.HarnessNode, // maturity height are as expected. // // NOTE: only used in current test file. -func checkCommitmentMaturity(forceClose lntemp.PendingForceClose, +func checkCommitmentMaturity(forceClose lntest.PendingForceClose, maturityHeight uint32, blocksTilMaturity int32) error { if forceClose.MaturityHeight != maturityHeight { diff --git a/itest/lnd_channel_graph_test.go b/itest/lnd_channel_graph_test.go index 0bfc31b7c..b01879c18 100644 --- a/itest/lnd_channel_graph_test.go +++ b/itest/lnd_channel_graph_test.go @@ -11,8 +11,8 @@ import ( "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/peersrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/lntest/wait" "github.com/stretchr/testify/require" ) @@ -40,7 +40,7 @@ import ( // take more than 5 seconds to finish, the channel will be marked as disabled, // thus a following operation will fail if it relies on the channel being // enabled. -func testUpdateChanStatus(ht *lntemp.HarnessTest) { +func testUpdateChanStatus(ht *lntest.HarnessTest) { // Create two fresh nodes and open a channel between them. alice, bob := ht.Alice, ht.Bob args := []string{ @@ -57,7 +57,7 @@ func testUpdateChanStatus(ht *lntemp.HarnessTest) { // being the sole funder of the channel. chanAmt := btcutil.Amount(100000) chanPoint := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{Amt: chanAmt}, + alice, bob, lntest.OpenChannelParams{Amt: chanAmt}, ) defer ht.CloseChannel(alice, chanPoint) @@ -141,7 +141,7 @@ func testUpdateChanStatus(ht *lntemp.HarnessTest) { FeeRateMilliMsat: int64(chainreg.DefaultBitcoinFeeRate), TimeLockDelta: chainreg.DefaultBitcoinTimeLockDelta, MinHtlc: 1000, // default value - MaxHtlcMsat: lntemp.CalculateMaxHtlc(chanAmt), + MaxHtlcMsat: lntest.CalculateMaxHtlc(chanAmt), } // Manually disable the channel and ensure that a "Disabled = true" @@ -217,14 +217,14 @@ func testUpdateChanStatus(ht *lntemp.HarnessTest) { // testUnannouncedChannels checks unannounced channels are not returned by // describeGraph RPC request unless explicitly asked for. -func testUnannouncedChannels(ht *lntemp.HarnessTest) { +func testUnannouncedChannels(ht *lntest.HarnessTest) { amount := funding.MaxBtcFundingAmount alice, bob := ht.Alice, ht.Bob // Open a channel between Alice and Bob, ensuring the // channel has been opened properly. chanOpenUpdate := ht.OpenChannelAssertStream( - alice, bob, lntemp.OpenChannelParams{Amt: amount}, + alice, bob, lntest.OpenChannelParams{Amt: amount}, ) // Mine 2 blocks, and check that the channel is opened but not yet @@ -252,7 +252,7 @@ func testUnannouncedChannels(ht *lntemp.HarnessTest) { ht.CloseChannel(alice, fundingChanPoint) } -func testGraphTopologyNotifications(ht *lntemp.HarnessTest) { +func testGraphTopologyNotifications(ht *lntest.HarnessTest) { ht.Run("pinned", func(t *testing.T) { subT := ht.Subtest(t) testGraphTopologyNtfns(subT, true) @@ -263,7 +263,7 @@ func testGraphTopologyNotifications(ht *lntemp.HarnessTest) { }) } -func testGraphTopologyNtfns(ht *lntemp.HarnessTest, pinned bool) { +func testGraphTopologyNtfns(ht *lntest.HarnessTest, pinned bool) { const chanAmt = funding.MaxBtcFundingAmount // Spin up Bob first, since we will need to grab his pubkey when @@ -305,7 +305,7 @@ func testGraphTopologyNtfns(ht *lntemp.HarnessTest, pinned bool) { // Open a new channel between Alice and Bob. chanPoint := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{Amt: chanAmt}, + alice, bob, lntest.OpenChannelParams{Amt: chanAmt}, ) // The channel opening above should have triggered a few notifications @@ -343,7 +343,7 @@ func testGraphTopologyNtfns(ht *lntemp.HarnessTest, pinned bool) { carol := ht.NewNode("Carol", nil) ht.ConnectNodes(bob, carol) chanPoint = ht.OpenChannel( - bob, carol, lntemp.OpenChannelParams{Amt: chanAmt}, + bob, carol, lntest.OpenChannelParams{Amt: chanAmt}, ) // Reconnect Alice and Bob. This should result in the nodes syncing up @@ -366,7 +366,7 @@ func testGraphTopologyNtfns(ht *lntemp.HarnessTest, pinned bool) { // testNodeAnnouncement ensures that when a node is started with one or more // external IP addresses specified on the command line, that those addresses // announced to the network and reported in the network graph. -func testNodeAnnouncement(ht *lntemp.HarnessTest) { +func testNodeAnnouncement(ht *lntest.HarnessTest) { alice, bob := ht.Alice, ht.Bob advertisedAddrs := []string{ @@ -392,7 +392,7 @@ func testNodeAnnouncement(ht *lntemp.HarnessTest) { // ensures that Alice receives the node announcement from Bob as part of // the announcement broadcast. chanPoint := ht.OpenChannel( - bob, dave, lntemp.OpenChannelParams{Amt: 1000000}, + bob, dave, lntest.OpenChannelParams{Amt: 1000000}, ) assertAddrs := func(addrsFound []string, targetAddrs ...string) { @@ -421,7 +421,7 @@ func testNodeAnnouncement(ht *lntemp.HarnessTest) { // testUpdateNodeAnnouncement ensures that the RPC endpoint validates // the requests correctly and that the new node announcement is brodcasted // with the right information after updating our node. -func testUpdateNodeAnnouncement(ht *lntemp.HarnessTest) { +func testUpdateNodeAnnouncement(ht *lntest.HarnessTest) { alice, bob := ht.Alice, ht.Bob var lndArgs []string @@ -500,7 +500,7 @@ func testUpdateNodeAnnouncement(ht *lntemp.HarnessTest) { // ensures that Alice receives the node announcement from Bob as part of // the announcement broadcast. chanPoint := ht.OpenChannel( - bob, dave, lntemp.OpenChannelParams{ + bob, dave, lntest.OpenChannelParams{ Amt: 1000000, }, ) @@ -637,7 +637,7 @@ func testUpdateNodeAnnouncement(ht *lntemp.HarnessTest) { // assertSyncType asserts that the peer has an expected syncType. // // NOTE: only made for tests in this file. -func assertSyncType(ht *lntemp.HarnessTest, hn *node.HarnessNode, +func assertSyncType(ht *lntest.HarnessTest, hn *node.HarnessNode, peer string, syncType lnrpc.Peer_SyncType) { resp := hn.RPC.ListPeers() @@ -693,7 +693,7 @@ func compareNodeAnns(n1, n2 *lnrpc.NodeUpdate) error { // the response expected values. // // NOTE: only used for tests in this file. -func assertUpdateNodeAnnouncementResponse(ht *lntemp.HarnessTest, +func assertUpdateNodeAnnouncementResponse(ht *lntest.HarnessTest, response *peersrpc.NodeAnnouncementUpdateResponse, expectedOps map[string]int) { diff --git a/itest/lnd_channel_policy_test.go b/itest/lnd_channel_policy_test.go index 1d2f75e1e..876e8fd68 100644 --- a/itest/lnd_channel_policy_test.go +++ b/itest/lnd_channel_policy_test.go @@ -10,22 +10,22 @@ import ( "github.com/lightningnetwork/lnd/funding" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/lnwire" "github.com/stretchr/testify/require" ) // testUpdateChannelPolicy tests that policy updates made to a channel // gets propagated to other nodes in the network. -func testUpdateChannelPolicy(ht *lntemp.HarnessTest) { +func testUpdateChannelPolicy(ht *lntest.HarnessTest) { const ( defaultFeeBase = 1000 defaultFeeRate = 1 defaultTimeLockDelta = chainreg.DefaultBitcoinTimeLockDelta defaultMinHtlc = 1000 ) - defaultMaxHtlc := lntemp.CalculateMaxHtlc(funding.MaxBtcFundingAmount) + defaultMaxHtlc := lntest.CalculateMaxHtlc(funding.MaxBtcFundingAmount) chanAmt := funding.MaxBtcFundingAmount pushAmt := chanAmt / 2 @@ -34,7 +34,7 @@ func testUpdateChannelPolicy(ht *lntemp.HarnessTest) { // Create a channel Alice->Bob. chanPoint := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{ + alice, bob, lntest.OpenChannelParams{ Amt: chanAmt, PushAmt: pushAmt, }, @@ -87,7 +87,7 @@ func testUpdateChannelPolicy(ht *lntemp.HarnessTest) { // part of his ChannelUpdate. const customMinHtlc = 5000 chanPoint2 := ht.OpenChannel( - carol, bob, lntemp.OpenChannelParams{ + carol, bob, lntest.OpenChannelParams{ Amt: chanAmt, PushAmt: pushAmt, MinHtlc: customMinHtlc, @@ -283,7 +283,7 @@ func testUpdateChannelPolicy(ht *lntemp.HarnessTest) { // We'll now open a channel from Alice directly to Carol. ht.ConnectNodes(alice, carol) chanPoint3 := ht.OpenChannel( - alice, carol, lntemp.OpenChannelParams{ + alice, carol, lntest.OpenChannelParams{ Amt: chanAmt, PushAmt: pushAmt, }, @@ -424,7 +424,7 @@ func testUpdateChannelPolicy(ht *lntemp.HarnessTest) { // chan-disable-timeout flags here. For instance, if some operations take more // than 6 seconds to finish, the channel will be marked as disabled, thus a // following operation will fail if it relies on the channel being enabled. -func testSendUpdateDisableChannel(ht *lntemp.HarnessTest) { +func testSendUpdateDisableChannel(ht *lntest.HarnessTest) { const chanAmt = 100000 alice, bob := ht.Alice, ht.Bob @@ -467,8 +467,8 @@ func testSendUpdateDisableChannel(ht *lntemp.HarnessTest) { // We now proceed to open channels: Alice=>Bob, Alice=>Carol and // Eve=>Carol. - p := lntemp.OpenChannelParams{Amt: chanAmt} - reqs := []*lntemp.OpenChannelRequest{ + p := lntest.OpenChannelParams{Amt: chanAmt} + reqs := []*lntest.OpenChannelRequest{ {Local: alice, Remote: bob, Param: p}, {Local: alice, Remote: carol, Param: p}, {Local: eve, Remote: carol, Param: p}, @@ -513,7 +513,7 @@ func testSendUpdateDisableChannel(ht *lntemp.HarnessTest) { FeeRateMilliMsat: int64(chainreg.DefaultBitcoinFeeRate), TimeLockDelta: chainreg.DefaultBitcoinTimeLockDelta, MinHtlc: 1000, // default value - MaxHtlcMsat: lntemp.CalculateMaxHtlc(chanAmt), + MaxHtlcMsat: lntest.CalculateMaxHtlc(chanAmt), Disabled: true, } @@ -655,7 +655,7 @@ func testSendUpdateDisableChannel(ht *lntemp.HarnessTest) { // Bob will update the base fee via UpdateChannelPolicy, we will test that // Alice will not fail the payment and send it using the updated channel // policy. -func testUpdateChannelPolicyForPrivateChannel(ht *lntemp.HarnessTest) { +func testUpdateChannelPolicyForPrivateChannel(ht *lntest.HarnessTest) { const ( chanAmt = btcutil.Amount(100000) paymentAmt = 20000 @@ -668,7 +668,7 @@ func testUpdateChannelPolicyForPrivateChannel(ht *lntemp.HarnessTest) { // Open a channel with 100k satoshis between Alice and Bob. chanPointAliceBob := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{ + alice, bob, lntest.OpenChannelParams{ Amt: chanAmt, }, ) @@ -681,7 +681,7 @@ func testUpdateChannelPolicyForPrivateChannel(ht *lntemp.HarnessTest) { // Open a channel with 100k satoshis between Bob and Carol. chanPointBobCarol := ht.OpenChannel( - bob, carol, lntemp.OpenChannelParams{ + bob, carol, lntest.OpenChannelParams{ Amt: chanAmt, Private: true, }, @@ -755,14 +755,14 @@ func testUpdateChannelPolicyForPrivateChannel(ht *lntemp.HarnessTest) { // testUpdateChannelPolicyFeeRateAccuracy tests that updating the channel policy // rounds fee rate values correctly as well as setting fee rate with ppm works // as expected. -func testUpdateChannelPolicyFeeRateAccuracy(ht *lntemp.HarnessTest) { +func testUpdateChannelPolicyFeeRateAccuracy(ht *lntest.HarnessTest) { chanAmt := funding.MaxBtcFundingAmount pushAmt := chanAmt / 2 // Create a channel Alice -> Bob. alice, bob := ht.Alice, ht.Bob chanPoint := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{ + alice, bob, lntest.OpenChannelParams{ Amt: chanAmt, PushAmt: pushAmt, }, @@ -826,7 +826,7 @@ func testUpdateChannelPolicyFeeRateAccuracy(ht *lntemp.HarnessTest) { // assertNodesPolicyUpdate checks that a given policy update has been received // by a list of given nodes. -func assertNodesPolicyUpdate(ht *lntemp.HarnessTest, nodes []*node.HarnessNode, +func assertNodesPolicyUpdate(ht *lntest.HarnessTest, nodes []*node.HarnessNode, advertisingNode *node.HarnessNode, policy *lnrpc.RoutingPolicy, chanPoint *lnrpc.ChannelPoint) { diff --git a/itest/lnd_custom_message.go b/itest/lnd_custom_message.go index 5faf425a1..14a4e7949 100644 --- a/itest/lnd_custom_message.go +++ b/itest/lnd_custom_message.go @@ -5,7 +5,7 @@ import ( "time" "github.com/lightningnetwork/lnd/lnrpc" - "github.com/lightningnetwork/lnd/lntemp" + "github.com/lightningnetwork/lnd/lntest" "github.com/lightningnetwork/lnd/lnwire" "github.com/stretchr/testify/require" ) @@ -13,7 +13,7 @@ import ( // testCustomMessage tests sending and receiving of overridden custom message // types (within the message type range usually reserved for protocol messages) // via the send and subscribe custom message APIs. -func testCustomMessage(ht *lntemp.HarnessTest) { +func testCustomMessage(ht *lntest.HarnessTest) { alice, bob := ht.Alice, ht.Bob var ( @@ -82,7 +82,7 @@ func testCustomMessage(ht *lntemp.HarnessTest) { require.Equal(ht, bob.PubKey[:], msg.Peer, "first msg "+ "peer wrong") - case <-time.After(defaultTimeout): + case <-time.After(lntest.DefaultTimeout): ht.Fatalf("alice did not receive first custom message: %v", msgType) } @@ -151,7 +151,7 @@ func testCustomMessage(ht *lntemp.HarnessTest) { require.Equal(ht, bob.PubKey[:], msg.Peer, "second "+ "message peer") - case <-time.After(defaultTimeout): + case <-time.After(lntest.DefaultTimeout): ht.Fatalf("alice did not receive second custom message") } } diff --git a/itest/lnd_etcd_failover_test.go b/itest/lnd_etcd_failover_test.go index 0488191f8..81021572e 100644 --- a/itest/lnd_etcd_failover_test.go +++ b/itest/lnd_etcd_failover_test.go @@ -12,12 +12,12 @@ import ( "github.com/lightningnetwork/lnd/kvdb" "github.com/lightningnetwork/lnd/lncfg" "github.com/lightningnetwork/lnd/lnrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/stretchr/testify/require" ) -func assertLeader(ht *lntemp.HarnessTest, observer cluster.LeaderElector, +func assertLeader(ht *lntest.HarnessTest, observer cluster.LeaderElector, expected string) { leader, err := observer.Leader(ht.Context()) @@ -29,7 +29,7 @@ func assertLeader(ht *lntemp.HarnessTest, observer cluster.LeaderElector, // testEtcdFailover tests that in a cluster setup where two LND nodes form a // single cluster (sharing the same identity) one can hand over the leader role // to the other (failing over after graceful shutdown or forceful abort). -func testEtcdFailover(ht *lntemp.HarnessTest) { +func testEtcdFailover(ht *lntest.HarnessTest) { testCases := []struct { name string kill bool @@ -54,7 +54,7 @@ func testEtcdFailover(ht *lntemp.HarnessTest) { } } -func testEtcdFailoverCase(ht *lntemp.HarnessTest, kill bool) { +func testEtcdFailoverCase(ht *lntest.HarnessTest, kill bool) { etcdCfg, cleanup, err := kvdb.StartEtcdTestBackend( ht.T.TempDir(), uint16(node.NextAvailablePort()), uint16(node.NextAvailablePort()), "", @@ -91,7 +91,7 @@ func testEtcdFailoverCase(ht *lntemp.HarnessTest, kill bool) { // Open a channel with 100k satoshis between Carol and Alice with Alice // being the sole funder of the channel. chanAmt := btcutil.Amount(100_000) - ht.OpenChannel(alice, carol1, lntemp.OpenChannelParams{Amt: chanAmt}) + ht.OpenChannel(alice, carol1, lntest.OpenChannelParams{Amt: chanAmt}) // At this point Carol-1 is the elected leader, while Carol-2 will wait // to become the leader when Carol-1 stops. diff --git a/itest/lnd_forward_interceptor_test.go b/itest/lnd_forward_interceptor_test.go index 4f667552b..f0ea5b6c5 100644 --- a/itest/lnd_forward_interceptor_test.go +++ b/itest/lnd_forward_interceptor_test.go @@ -9,8 +9,8 @@ import ( "github.com/lightningnetwork/lnd/chainreg" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/lntest/wait" "github.com/lightningnetwork/lnd/lntypes" "github.com/lightningnetwork/lnd/routing/route" @@ -34,7 +34,7 @@ type interceptorTestCase struct { // testForwardInterceptorDedupHtlc tests that upon reconnection, duplicate // HTLCs aren't re-notified using the HTLC interceptor API. -func testForwardInterceptorDedupHtlc(ht *lntemp.HarnessTest) { +func testForwardInterceptorDedupHtlc(ht *lntest.HarnessTest) { // Initialize the test context with 3 connected nodes. ts := newInterceptorTestScenario(ht) @@ -42,8 +42,8 @@ func testForwardInterceptorDedupHtlc(ht *lntemp.HarnessTest) { // Open and wait for channels. const chanAmt = btcutil.Amount(300000) - p := lntemp.OpenChannelParams{Amt: chanAmt} - reqs := []*lntemp.OpenChannelRequest{ + p := lntest.OpenChannelParams{Amt: chanAmt} + reqs := []*lntest.OpenChannelRequest{ {Local: alice, Remote: bob, Param: p}, {Local: bob, Remote: carol, Param: p}, } @@ -185,15 +185,15 @@ func testForwardInterceptorDedupHtlc(ht *lntemp.HarnessTest) { // 3. Intercepted held htlcs result in no payment (invoice is not settled). // 4. When Interceptor disconnects it resumes all held htlcs, which result in // valid payment (invoice is settled). -func testForwardInterceptorBasic(ht *lntemp.HarnessTest) { +func testForwardInterceptorBasic(ht *lntest.HarnessTest) { ts := newInterceptorTestScenario(ht) alice, bob, carol := ts.alice, ts.bob, ts.carol // Open and wait for channels. const chanAmt = btcutil.Amount(300000) - p := lntemp.OpenChannelParams{Amt: chanAmt} - reqs := []*lntemp.OpenChannelRequest{ + p := lntest.OpenChannelParams{Amt: chanAmt} + reqs := []*lntest.OpenChannelRequest{ {Local: alice, Remote: bob, Param: p}, {Local: bob, Remote: carol, Param: p}, } @@ -345,7 +345,7 @@ func testForwardInterceptorBasic(ht *lntemp.HarnessTest) { // interceptorTestScenario is a helper struct to hold the test context and // provide the needed functionality. type interceptorTestScenario struct { - ht *lntemp.HarnessTest + ht *lntest.HarnessTest alice, bob, carol *node.HarnessNode } @@ -356,7 +356,7 @@ type interceptorTestScenario struct { // // Among them, Alice and Bob are standby nodes and Carol is a new node. func newInterceptorTestScenario( - ht *lntemp.HarnessTest) *interceptorTestScenario { + ht *lntest.HarnessTest) *interceptorTestScenario { alice, bob := ht.Alice, ht.Bob carol := ht.NewNode("carol", nil) diff --git a/itest/lnd_funding_test.go b/itest/lnd_funding_test.go index 1bfb733af..432261ffb 100644 --- a/itest/lnd_funding_test.go +++ b/itest/lnd_funding_test.go @@ -13,8 +13,8 @@ import ( "github.com/lightningnetwork/lnd/labels" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/signrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/lnwire" "github.com/stretchr/testify/require" ) @@ -24,7 +24,7 @@ import ( // Bob, then immediately closes the channel after asserting some expected post // conditions. Finally, the chain itself is checked to ensure the closing // transaction was mined. -func testBasicChannelFunding(ht *lntemp.HarnessTest) { +func testBasicChannelFunding(ht *lntest.HarnessTest) { // Run through the test with combinations of all the different // commitment types. allTypes := []lnrpc.CommitmentType{ @@ -35,20 +35,20 @@ func testBasicChannelFunding(ht *lntemp.HarnessTest) { // testFunding is a function closure that takes Carol and Dave's // commitment types and test the funding flow. - testFunding := func(ht *lntemp.HarnessTest, carolCommitType, + testFunding := func(ht *lntest.HarnessTest, carolCommitType, daveCommitType lnrpc.CommitmentType) { // Based on the current tweak variable for Carol, we'll // preferentially signal the legacy commitment format. We do // the same for Dave shortly below. - carolArgs := lntemp.NodeArgsForCommitType(carolCommitType) + carolArgs := lntest.NodeArgsForCommitType(carolCommitType) carol := ht.NewNode("Carol", carolArgs) // Each time, we'll send Carol a new set of coins in order to // fund the channel. ht.FundCoins(btcutil.SatoshiPerBitcoin, carol) - daveArgs := lntemp.NodeArgsForCommitType(daveCommitType) + daveArgs := lntest.NodeArgsForCommitType(daveCommitType) dave := ht.NewNode("Dave", daveArgs) // Before we start the test, we'll ensure both sides are @@ -140,7 +140,7 @@ test: // test. Given two nodes: Alice and Bob, it'll assert proper channel creation, // then return a function closure that should be called to assert proper // channel closure. -func basicChannelFundingTest(ht *lntemp.HarnessTest, +func basicChannelFundingTest(ht *lntest.HarnessTest, alice, bob *node.HarnessNode, fundingShim *lnrpc.FundingShim) (*lnrpc.Channel, *lnrpc.Channel, func()) { @@ -181,7 +181,7 @@ func basicChannelFundingTest(ht *lntemp.HarnessTest, // assertions will be executed to ensure the funding process completed // successfully. chanPoint := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{ + alice, bob, lntest.OpenChannelParams{ Amt: chanAmt, PushAmt: pushAmt, FundingShim: fundingShim, @@ -193,7 +193,7 @@ func basicChannelFundingTest(ht *lntemp.HarnessTest, // With the channel open, ensure that the amount specified above has // properly been pushed to Bob. - aliceLocalBalance := chanAmt - pushAmt - lntemp.CalcStaticFee(cType, 0) + aliceLocalBalance := chanAmt - pushAmt - lntest.CalcStaticFee(cType, 0) checkChannelBalance( alice, aliceChannelBalance, aliceLocalBalance, pushAmt, ) @@ -216,7 +216,7 @@ func basicChannelFundingTest(ht *lntemp.HarnessTest, // testUnconfirmedChannelFunding tests that our unconfirmed change outputs can // be used to fund channels. -func testUnconfirmedChannelFunding(ht *lntemp.HarnessTest) { +func testUnconfirmedChannelFunding(ht *lntest.HarnessTest) { const ( chanAmt = funding.MaxBtcFundingAmount pushAmt = btcutil.Amount(100000) @@ -236,7 +236,7 @@ func testUnconfirmedChannelFunding(ht *lntemp.HarnessTest) { ht.ConnectNodes(carol, alice) chanOpenUpdate := ht.OpenChannelAssertStream( - carol, alice, lntemp.OpenChannelParams{ + carol, alice, lntest.OpenChannelParams{ Amt: chanAmt, PushAmt: pushAmt, SpendUnconfirmed: true, @@ -289,7 +289,7 @@ func testUnconfirmedChannelFunding(ht *lntemp.HarnessTest) { // Note that atm we haven't obtained the chanPoint yet, so we use the // type directly. cType := lnrpc.CommitmentType_STATIC_REMOTE_KEY - carolLocalBalance := chanAmt - pushAmt - lntemp.CalcStaticFee(cType, 0) + carolLocalBalance := chanAmt - pushAmt - lntest.CalcStaticFee(cType, 0) checkChannelBalance(carol, 0, 0, carolLocalBalance, pushAmt) // For Alice, her local/remote balances should be zero, and the @@ -329,7 +329,12 @@ func testUnconfirmedChannelFunding(ht *lntemp.HarnessTest) { // testChannelFundingInputTypes tests that any type of supported input type can // be used to fund channels. -func testChannelFundingInputTypes(ht *lntemp.HarnessTest) { +func testChannelFundingInputTypes(ht *lntest.HarnessTest) { + const ( + chanAmt = funding.MaxBtcFundingAmount + burnAddr = "bcrt1qxsnqpdc842lu8c0xlllgvejt6rhy49u6fmpgyz" + ) + // We'll start off by creating a node for Carol. carol := ht.NewNode("Carol", nil) @@ -342,7 +347,7 @@ func testChannelFundingInputTypes(ht *lntemp.HarnessTest) { // runChannelFundingInputTypes tests that any type of supported input type can // be used to fund channels. -func runChannelFundingInputTypes(ht *lntemp.HarnessTest, alice, +func runChannelFundingInputTypes(ht *lntest.HarnessTest, alice, carol *node.HarnessNode) { const ( @@ -411,7 +416,7 @@ func runChannelFundingInputTypes(ht *lntemp.HarnessTest, alice, funder((chanAmt*11)/10, carol) chanOpenUpdate := ht.OpenChannelAssertStream( - carol, alice, lntemp.OpenChannelParams{ + carol, alice, lntest.OpenChannelParams{ Amt: chanAmt, }, ) @@ -423,7 +428,7 @@ func runChannelFundingInputTypes(ht *lntemp.HarnessTest, alice, // Note that atm we haven't obtained the chanPoint yet, so we // use the type directly. cType := lnrpc.CommitmentType_STATIC_REMOTE_KEY - carolLocalBalance := chanAmt - lntemp.CalcStaticFee(cType, 0) + carolLocalBalance := chanAmt - lntest.CalcStaticFee(cType, 0) checkChannelBalance(carol, 0, 0, carolLocalBalance, 0) // For Alice, her local/remote balances should be zero, and the @@ -463,7 +468,7 @@ func runChannelFundingInputTypes(ht *lntemp.HarnessTest, alice, // sendAllCoinsConfirm sends all coins of the node's wallet to the given address // and awaits one confirmation. -func sendAllCoinsConfirm(ht *lntemp.HarnessTest, node *node.HarnessNode, +func sendAllCoinsConfirm(ht *lntest.HarnessTest, node *node.HarnessNode, addr string) { sweepReq := &lnrpc.SendCoinsRequest{ @@ -477,7 +482,7 @@ func sendAllCoinsConfirm(ht *lntemp.HarnessTest, node *node.HarnessNode, // testExternalFundingChanPoint tests that we're able to carry out a normal // channel funding workflow given a channel point that was constructed outside // the main daemon. -func testExternalFundingChanPoint(ht *lntemp.HarnessTest) { +func testExternalFundingChanPoint(ht *lntest.HarnessTest) { // First, we'll create two new nodes that we'll use to open channel // between for this test. carol := ht.NewNode("carol", nil) @@ -500,7 +505,7 @@ func testExternalFundingChanPoint(ht *lntemp.HarnessTest) { ht, carol, dave, chanSize, thawHeight, false, ) ht.OpenChannelAssertPending( - carol, dave, lntemp.OpenChannelParams{ + carol, dave, lntest.OpenChannelParams{ Amt: chanSize, FundingShim: fundingShim1, }, @@ -591,7 +596,7 @@ func testExternalFundingChanPoint(ht *lntemp.HarnessTest) { // representation of channels if the system is restarted or disconnected. // testFundingPersistence mirrors testBasicChannelFunding, but adds restarts // and checks for the state of channels with unconfirmed funding transactions. -func testChannelFundingPersistence(ht *lntemp.HarnessTest) { +func testChannelFundingPersistence(ht *lntest.HarnessTest) { chanAmt := funding.MaxBtcFundingAmount pushAmt := btcutil.Amount(0) @@ -609,7 +614,7 @@ func testChannelFundingPersistence(ht *lntemp.HarnessTest) { // Create a new channel that requires 5 confs before it's considered // open, then broadcast the funding transaction - param := lntemp.OpenChannelParams{ + param := lntest.OpenChannelParams{ Amt: chanAmt, PushAmt: pushAmt, } @@ -676,7 +681,7 @@ func testChannelFundingPersistence(ht *lntemp.HarnessTest) { // The channel should be listed in the peer information returned by // both peers. - chanPoint := lntemp.ChanPointFromPendingUpdate(update) + chanPoint := lntest.ChanPointFromPendingUpdate(update) // Re-lookup our transaction in the block that it confirmed in. tx = ht.AssertTxAtHeight(alice, height, fundingTxID) @@ -699,7 +704,7 @@ func testChannelFundingPersistence(ht *lntemp.HarnessTest) { // testBatchChanFunding makes sure multiple channels can be opened in one batch // transaction in an atomic way. -func testBatchChanFunding(ht *lntemp.HarnessTest) { +func testBatchChanFunding(ht *lntest.HarnessTest) { // First, we'll create two new nodes that we'll use to open channels // to during this test. Carol has a high minimum funding amount that // we'll use to trigger an error during the batch channel open. @@ -793,7 +798,7 @@ func testBatchChanFunding(ht *lntemp.HarnessTest) { // deriveFundingShim creates a channel funding shim by deriving the necessary // keys on both sides. -func deriveFundingShim(ht *lntemp.HarnessTest, +func deriveFundingShim(ht *lntest.HarnessTest, carol, dave *node.HarnessNode, chanSize btcutil.Amount, thawHeight uint32, publish bool) (*lnrpc.FundingShim, *lnrpc.ChannelPoint, *chainhash.Hash) { diff --git a/itest/lnd_hold_invoice_force_test.go b/itest/lnd_hold_invoice_force_test.go index 613281305..a3d832614 100644 --- a/itest/lnd_hold_invoice_force_test.go +++ b/itest/lnd_hold_invoice_force_test.go @@ -7,7 +7,7 @@ import ( "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/invoicesrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" - "github.com/lightningnetwork/lnd/lntemp" + "github.com/lightningnetwork/lnd/lntest" "github.com/lightningnetwork/lnd/lntest/wait" "github.com/lightningnetwork/lnd/lntypes" "github.com/stretchr/testify/require" @@ -15,11 +15,11 @@ import ( // testHoldInvoiceForceClose tests cancellation of accepted hold invoices which // would otherwise trigger force closes when they expire. -func testHoldInvoiceForceClose(ht *lntemp.HarnessTest) { +func testHoldInvoiceForceClose(ht *lntest.HarnessTest) { // Open a channel between alice and bob. alice, bob := ht.Alice, ht.Bob chanPoint := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{Amt: 300000}, + alice, bob, lntest.OpenChannelParams{Amt: 300000}, ) // Create a non-dust hold invoice for bob. diff --git a/itest/lnd_hold_persistence_test.go b/itest/lnd_hold_persistence_test.go index da5424ca3..c7cd5eac2 100644 --- a/itest/lnd_hold_persistence_test.go +++ b/itest/lnd_hold_persistence_test.go @@ -7,8 +7,8 @@ import ( "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/invoicesrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/rpc" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/rpc" "github.com/lightningnetwork/lnd/lntest/wait" "github.com/lightningnetwork/lnd/lntypes" "github.com/stretchr/testify/require" @@ -17,7 +17,7 @@ import ( // testHoldInvoicePersistence tests that a sender to a hold-invoice, can be // restarted before the payment gets settled, and still be able to receive the // preimage. -func testHoldInvoicePersistence(ht *lntemp.HarnessTest) { +func testHoldInvoicePersistence(ht *lntest.HarnessTest) { const ( chanAmt = btcutil.Amount(1000000) numPayments = 10 @@ -34,7 +34,7 @@ func testHoldInvoicePersistence(ht *lntemp.HarnessTest) { // Open a channel between Alice and Carol which is private so that we // cover the addition of hop hints for hold invoices. chanPointAlice := ht.OpenChannel( - alice, carol, lntemp.OpenChannelParams{ + alice, carol, lntest.OpenChannelParams{ Amt: chanAmt, Private: true, }, @@ -45,7 +45,7 @@ func testHoldInvoicePersistence(ht *lntemp.HarnessTest) { // has at least one public channel in the graph. We open a public // channel from Alice -> Bob and wait for Carol to see it. chanPointBob := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{ + alice, bob, lntest.OpenChannelParams{ Amt: chanAmt, }, ) diff --git a/itest/lnd_macaroons_test.go b/itest/lnd_macaroons_test.go index 01d576f8f..b5dad77bb 100644 --- a/itest/lnd_macaroons_test.go +++ b/itest/lnd_macaroons_test.go @@ -11,8 +11,8 @@ import ( "github.com/golang/protobuf/proto" "github.com/lightningnetwork/lnd/lnrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/macaroons" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -23,7 +23,7 @@ import ( // enabled on the gRPC interface, no requests with missing or invalid // macaroons are allowed. Further, the specific access rights (read/write, // entity based) and first-party caveats are tested as well. -func testMacaroonAuthentication(ht *lntemp.HarnessTest) { +func testMacaroonAuthentication(ht *lntest.HarnessTest) { var ( infoReq = &lnrpc.GetInfoRequest{} newAddrReq = &lnrpc.NewAddressRequest{ @@ -294,7 +294,7 @@ func testMacaroonAuthentication(ht *lntemp.HarnessTest) { // testBakeMacaroon checks that when creating macaroons, the permissions param // in the request must be set correctly, and the baked macaroon has the intended // permissions. -func testBakeMacaroon(ht *lntemp.HarnessTest) { +func testBakeMacaroon(ht *lntest.HarnessTest) { var testNode = ht.Alice testCases := []struct { @@ -518,7 +518,7 @@ func testBakeMacaroon(ht *lntemp.HarnessTest) { // specified ID and invalidates all macaroons derived from the key with that ID. // Also, it checks deleting the reserved marcaroon ID, DefaultRootKeyID or is // forbidden. -func testDeleteMacaroonID(ht *lntemp.HarnessTest) { +func testDeleteMacaroonID(ht *lntest.HarnessTest) { var ( ctxb = ht.Context() testNode = ht.Alice @@ -610,7 +610,7 @@ func testDeleteMacaroonID(ht *lntemp.HarnessTest) { // does not write any macaroon files to the daemon's file system and returns // the admin macaroon in the response. It then checks that the password // change of the wallet can also happen stateless. -func testStatelessInit(ht *lntemp.HarnessTest) { +func testStatelessInit(ht *lntest.HarnessTest) { var ( initPw = []byte("stateless") newPw = []byte("stateless-new") diff --git a/itest/lnd_max_channel_size_test.go b/itest/lnd_max_channel_size_test.go index 320ccabe4..9959c7589 100644 --- a/itest/lnd_max_channel_size_test.go +++ b/itest/lnd_max_channel_size_test.go @@ -5,14 +5,14 @@ import ( "github.com/btcsuite/btcd/btcutil" "github.com/lightningnetwork/lnd/funding" - "github.com/lightningnetwork/lnd/lntemp" + "github.com/lightningnetwork/lnd/lntest" "github.com/lightningnetwork/lnd/lnwallet" ) // testMaxChannelSize tests that lnd handles --maxchansize parameter correctly. // Wumbo nodes should enforce a default soft limit of 10 BTC by default. This // limit can be adjusted with --maxchansize config option. -func testMaxChannelSize(ht *lntemp.HarnessTest) { +func testMaxChannelSize(ht *lntest.HarnessTest) { // We'll make two new nodes, both wumbo but with the default limit on // maximum channel size (10 BTC) wumboNode := ht.NewNode( @@ -39,7 +39,7 @@ func testMaxChannelSize(ht *lntemp.HarnessTest) { ) ht.OpenChannelAssertErr( wumboNode, wumboNode2, - lntemp.OpenChannelParams{Amt: chanAmt}, expectedErr, + lntest.OpenChannelParams{Amt: chanAmt}, expectedErr, ) // We'll now make another wumbo node with appropriate maximum channel @@ -57,7 +57,7 @@ func testMaxChannelSize(ht *lntemp.HarnessTest) { // Creating a wumbo channel between these two nodes should succeed. ht.EnsureConnected(wumboNode, wumboNode3) chanPoint := ht.OpenChannel( - wumboNode, wumboNode3, lntemp.OpenChannelParams{Amt: chanAmt}, + wumboNode, wumboNode3, lntest.OpenChannelParams{Amt: chanAmt}, ) ht.CloseChannel(wumboNode, chanPoint) diff --git a/itest/lnd_max_htlcs_test.go b/itest/lnd_max_htlcs_test.go index d457e452f..72d6ac031 100644 --- a/itest/lnd_max_htlcs_test.go +++ b/itest/lnd_max_htlcs_test.go @@ -4,8 +4,8 @@ import ( "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/invoicesrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/lntypes" "github.com/stretchr/testify/require" ) @@ -14,14 +14,14 @@ import ( // channel where we have already reached the limit of the number of htlcs that // we may add to the remote party's commitment. This test asserts that we do // not attempt to use the full channel at all in our pathfinding. -func testMaxHtlcPathfind(ht *lntemp.HarnessTest) { +func testMaxHtlcPathfind(ht *lntest.HarnessTest) { // Setup a channel between Alice and Bob where Alice will only allow // Bob to add a maximum of 5 htlcs to her commitment. maxHtlcs := 5 alice, bob := ht.Alice, ht.Bob chanPoint := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{ + alice, bob, lntest.OpenChannelParams{ Amt: 1000000, PushAmt: 800000, RemoteMaxHtlcs: uint16(maxHtlcs), @@ -84,7 +84,7 @@ type holdSubscription struct { // cancel updates a hold invoice to cancel from the recipient and consumes // updates from the payer until it has reached a final, failed state. -func (h *holdSubscription) cancel(ht *lntemp.HarnessTest) { +func (h *holdSubscription) cancel(ht *lntest.HarnessTest) { h.recipient.RPC.CancelInvoice(h.hash[:]) invUpdate := ht.ReceiveSingleInvoice(h.invSubscription) @@ -110,7 +110,7 @@ func (h *holdSubscription) cancel(ht *lntemp.HarnessTest) { // acceptHoldInvoice adds a hold invoice to the recipient node, pays it from // the sender and asserts that we have reached the accepted state where htlcs // are locked in for the payment. -func acceptHoldInvoice(ht *lntemp.HarnessTest, idx int, sender, +func acceptHoldInvoice(ht *lntest.HarnessTest, idx int, sender, receiver *node.HarnessNode) *holdSubscription { hash := [lntypes.HashSize]byte{byte(idx + 1)} diff --git a/itest/lnd_misc_test.go b/itest/lnd_misc_test.go index 04274fb35..a0f0e4616 100644 --- a/itest/lnd_misc_test.go +++ b/itest/lnd_misc_test.go @@ -15,8 +15,8 @@ import ( "github.com/lightningnetwork/lnd/lnrpc/invoicesrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" "github.com/lightningnetwork/lnd/lnrpc/walletrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/lntest/wait" "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/lnwire" @@ -28,7 +28,7 @@ import ( // disconnect at any point. // // TODO(yy): move to lnd_network_test. -func testDisconnectingTargetPeer(ht *lntemp.HarnessTest) { +func testDisconnectingTargetPeer(ht *lntest.HarnessTest) { // We'll start both nodes with a high backoff so that they don't // reconnect automatically during our test. args := []string{ @@ -49,7 +49,7 @@ func testDisconnectingTargetPeer(ht *lntemp.HarnessTest) { // Create a new channel that requires 1 confs before it's considered // open, then broadcast the funding transaction const numConfs = 1 - p := lntemp.OpenChannelParams{ + p := lntest.OpenChannelParams{ Amt: chanAmt, PushAmt: pushAmt, } @@ -119,7 +119,7 @@ func testDisconnectingTargetPeer(ht *lntemp.HarnessTest) { // configuration arguments to force Carol to replay the same sphinx packet // after reconnecting to Dave, and compare the returned failure message with // what we expect for replayed onion packets. -func testSphinxReplayPersistence(ht *lntemp.HarnessTest) { +func testSphinxReplayPersistence(ht *lntest.HarnessTest) { // Open a channel with 100k satoshis between Carol and Dave with Carol // being the sole funder of the channel. chanAmt := btcutil.Amount(100000) @@ -135,7 +135,7 @@ func testSphinxReplayPersistence(ht *lntemp.HarnessTest) { ht.ConnectNodes(carol, dave) chanPoint := ht.OpenChannel( - carol, dave, lntemp.OpenChannelParams{ + carol, dave, lntest.OpenChannelParams{ Amt: chanAmt, }, ) @@ -150,7 +150,7 @@ func testSphinxReplayPersistence(ht *lntemp.HarnessTest) { ht.ConnectNodes(fred, carol) chanPointFC := ht.OpenChannel( - fred, carol, lntemp.OpenChannelParams{ + fred, carol, lntest.OpenChannelParams{ Amt: chanAmt, }, ) @@ -232,7 +232,7 @@ func testSphinxReplayPersistence(ht *lntemp.HarnessTest) { // tests the values in all ChannelConstraints are returned as expected. Once // ListChannels becomes mature, a test against all fields in ListChannels // should be performed. -func testListChannels(ht *lntemp.HarnessTest) { +func testListChannels(ht *lntest.HarnessTest) { const aliceRemoteMaxHtlcs = 50 const bobRemoteMaxHtlcs = 100 @@ -255,7 +255,7 @@ func testListChannels(ht *lntemp.HarnessTest) { chanAmt := btcutil.Amount(100000) pushAmt := btcutil.Amount(1000) - p := lntemp.OpenChannelParams{ + p := lntest.OpenChannelParams{ Amt: chanAmt, PushAmt: pushAmt, MinHtlc: customizedMinHtlc, @@ -337,7 +337,7 @@ func testListChannels(ht *lntemp.HarnessTest) { // testMaxPendingChannels checks that error is returned from remote peer if // max pending channel number was exceeded and that '--maxpendingchannels' flag // exists and works properly. -func testMaxPendingChannels(ht *lntemp.HarnessTest) { +func testMaxPendingChannels(ht *lntest.HarnessTest) { maxPendingChannels := lncfg.DefaultMaxPendingChannels + 1 amount := funding.MaxBtcFundingAmount @@ -362,7 +362,7 @@ func testMaxPendingChannels(ht *lntemp.HarnessTest) { ) for i := 0; i < maxPendingChannels; i++ { stream := ht.OpenChannelAssertStream( - alice, carol, lntemp.OpenChannelParams{ + alice, carol, lntest.OpenChannelParams{ Amt: amount, }, ) @@ -372,7 +372,7 @@ func testMaxPendingChannels(ht *lntemp.HarnessTest) { // Carol exhausted available amount of pending channels, next open // channel request should cause ErrorGeneric to be sent back to Alice. ht.OpenChannelAssertErr( - alice, carol, lntemp.OpenChannelParams{ + alice, carol, lntest.OpenChannelParams{ Amt: amount, }, lnwire.ErrMaxPendingChannels, ) @@ -415,7 +415,7 @@ func testMaxPendingChannels(ht *lntemp.HarnessTest) { // testGarbageCollectLinkNodes tests that we properly garbage collect link // nodes from the database and the set of persistent connections within the // server. -func testGarbageCollectLinkNodes(ht *lntemp.HarnessTest) { +func testGarbageCollectLinkNodes(ht *lntest.HarnessTest) { const chanAmt = 1000000 alice, bob := ht.Alice, ht.Bob @@ -423,7 +423,7 @@ func testGarbageCollectLinkNodes(ht *lntemp.HarnessTest) { // Open a channel between Alice and Bob which will later be // cooperatively closed. coopChanPoint := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{ + alice, bob, lntest.OpenChannelParams{ Amt: chanAmt, }, ) @@ -435,7 +435,7 @@ func testGarbageCollectLinkNodes(ht *lntemp.HarnessTest) { // Open a channel between Alice and Carol which will later be force // closed. forceCloseChanPoint := ht.OpenChannel( - alice, carol, lntemp.OpenChannelParams{ + alice, carol, lntest.OpenChannelParams{ Amt: chanAmt, }, ) @@ -447,7 +447,7 @@ func testGarbageCollectLinkNodes(ht *lntemp.HarnessTest) { ht.ConnectNodes(alice, dave) persistentChanPoint := ht.OpenChannel( - alice, dave, lntemp.OpenChannelParams{ + alice, dave, lntest.OpenChannelParams{ Amt: chanAmt, }, ) @@ -527,7 +527,7 @@ func testGarbageCollectLinkNodes(ht *lntemp.HarnessTest) { // testRejectHTLC tests that a node can be created with the flag --rejecthtlc. // This means that the node will reject all forwarded HTLCs but can still // accept direct HTLCs as well as send HTLCs. -func testRejectHTLC(ht *lntemp.HarnessTest) { +func testRejectHTLC(ht *lntest.HarnessTest) { // RejectHTLC // Alice ------> Carol ------> Bob // @@ -548,14 +548,14 @@ func testRejectHTLC(ht *lntemp.HarnessTest) { // Open a channel between Alice and Carol. chanPointAlice := ht.OpenChannel( - alice, carol, lntemp.OpenChannelParams{ + alice, carol, lntest.OpenChannelParams{ Amt: chanAmt, }, ) // Open a channel between Carol and Bob. chanPointCarol := ht.OpenChannel( - carol, bob, lntemp.OpenChannelParams{ + carol, bob, lntest.OpenChannelParams{ Amt: chanAmt, }, ) @@ -623,14 +623,14 @@ func testRejectHTLC(ht *lntemp.HarnessTest) { // testNodeSignVerify checks that only connected nodes are allowed to perform // signing and verifying messages. -func testNodeSignVerify(ht *lntemp.HarnessTest) { +func testNodeSignVerify(ht *lntest.HarnessTest) { chanAmt := funding.MaxBtcFundingAmount pushAmt := btcutil.Amount(100000) alice, bob := ht.Alice, ht.Bob // Create a channel between alice and bob. aliceBobCh := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{ + alice, bob, lntest.OpenChannelParams{ Amt: chanAmt, PushAmt: pushAmt, }, @@ -670,11 +670,11 @@ func testNodeSignVerify(ht *lntemp.HarnessTest) { // testAbandonChannel abandons a channel and asserts that it is no longer open // and not in one of the pending closure states. It also verifies that the // abandoned channel is reported as closed with close type 'abandoned'. -func testAbandonChannel(ht *lntemp.HarnessTest) { +func testAbandonChannel(ht *lntest.HarnessTest) { alice, bob := ht.Alice, ht.Bob // First establish a channel between Alice and Bob. - channelParam := lntemp.OpenChannelParams{ + channelParam := lntest.OpenChannelParams{ Amt: funding.MaxBtcFundingAmount, PushAmt: btcutil.Amount(100000), } @@ -741,7 +741,7 @@ func testAbandonChannel(ht *lntemp.HarnessTest) { // wallet into a single target address at the specified fee rate. // // TODO(yy): expand this test to also use P2TR. -func testSweepAllCoins(ht *lntemp.HarnessTest) { +func testSweepAllCoins(ht *lntest.HarnessTest) { // First, we'll make a new node, ainz who'll we'll use to test wallet // sweeping. // @@ -917,7 +917,7 @@ func testSweepAllCoins(ht *lntemp.HarnessTest) { // testListAddresses tests that we get all the addresses and their // corresponding balance correctly. -func testListAddresses(ht *lntemp.HarnessTest) { +func testListAddresses(ht *lntest.HarnessTest) { // First, we'll make a new node - Alice, which will be generating // new addresses. alice := ht.NewNode("Alice", nil) @@ -985,7 +985,7 @@ func testListAddresses(ht *lntemp.HarnessTest) { foundAddresses := 0 for _, addressList := range addressLists.AccountWithAddresses { addresses := addressList.Addresses - derivationPath, err := lntemp.ParseDerivationPath( + derivationPath, err := lntest.ParseDerivationPath( addressList.DerivationPath, ) require.NoError(ht, err) @@ -1023,7 +1023,7 @@ func testListAddresses(ht *lntemp.HarnessTest) { for _, addressList := range addressLists.AccountWithAddresses { addresses := addressList.Addresses - derivationPath, err := lntemp.ParseDerivationPath( + derivationPath, err := lntest.ParseDerivationPath( addressList.DerivationPath, ) require.NoError(ht, err) @@ -1053,7 +1053,7 @@ func testListAddresses(ht *lntemp.HarnessTest) { require.Equal(ht, len(generatedAddr), foundAddresses) } -func assertChannelConstraintsEqual(ht *lntemp.HarnessTest, +func assertChannelConstraintsEqual(ht *lntest.HarnessTest, want, got *lnrpc.ChannelConstraints) { require.Equal(ht, want.CsvDelay, got.CsvDelay, "CsvDelay mismatched") @@ -1076,7 +1076,7 @@ func assertChannelConstraintsEqual(ht *lntemp.HarnessTest, // testSignVerifyMessageWithAddr tests signing and also verifying a signature // on a message with a provided address. -func testSignVerifyMessageWithAddr(ht *lntemp.HarnessTest) { +func testSignVerifyMessageWithAddr(ht *lntest.HarnessTest) { // Using different nodes to sign the message and verify the signature. alice, bob := ht.Alice, ht.Bob diff --git a/itest/lnd_mpp_test.go b/itest/lnd_mpp_test.go index c9d8fd4c2..4f0ed1666 100644 --- a/itest/lnd_mpp_test.go +++ b/itest/lnd_mpp_test.go @@ -7,8 +7,8 @@ import ( "github.com/lightningnetwork/lnd/chainreg" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/lntypes" "github.com/lightningnetwork/lnd/routing/route" "github.com/stretchr/testify/require" @@ -16,7 +16,7 @@ import ( // testSendToRouteMultiPath tests that we are able to successfully route a // payment using multiple shards across different paths, by using SendToRoute. -func testSendToRouteMultiPath(ht *lntemp.HarnessTest) { +func testSendToRouteMultiPath(ht *lntest.HarnessTest) { mts := newMppTestScenario(ht) // To ensure the payment goes through separate paths, we'll set a @@ -162,7 +162,7 @@ func testSendToRouteMultiPath(ht *lntemp.HarnessTest) { // It has two standby nodes, alice and bob, and three new nodes, carol, dave, // and eve. type mppTestScenario struct { - ht *lntemp.HarnessTest + ht *lntest.HarnessTest alice, bob, carol, dave, eve *node.HarnessNode nodes []*node.HarnessNode @@ -179,7 +179,7 @@ type mppTestScenario struct { // Alice -- Carol ---- Bob // \ / // \__ Dave ____/ -func newMppTestScenario(ht *lntemp.HarnessTest) *mppTestScenario { +func newMppTestScenario(ht *lntest.HarnessTest) *mppTestScenario { alice, bob := ht.Alice, ht.Bob ht.RestartNodeWithExtraArgs(bob, []string{ "--maxpendingchannels=2", @@ -256,36 +256,36 @@ type mppOpenChannelRequest struct { // // NOTE: all the channels are open together to save blocks mined. func (m *mppTestScenario) openChannels(r *mppOpenChannelRequest) { - reqs := []*lntemp.OpenChannelRequest{ + reqs := []*lntest.OpenChannelRequest{ { Local: m.alice, Remote: m.carol, - Param: lntemp.OpenChannelParams{Amt: r.amtAliceCarol}, + Param: lntest.OpenChannelParams{Amt: r.amtAliceCarol}, }, { Local: m.alice, Remote: m.dave, - Param: lntemp.OpenChannelParams{Amt: r.amtAliceDave}, + Param: lntest.OpenChannelParams{Amt: r.amtAliceDave}, }, { Local: m.carol, Remote: m.bob, - Param: lntemp.OpenChannelParams{Amt: r.amtCarolBob}, + Param: lntest.OpenChannelParams{Amt: r.amtCarolBob}, }, { Local: m.carol, Remote: m.eve, - Param: lntemp.OpenChannelParams{Amt: r.amtCarolEve}, + Param: lntest.OpenChannelParams{Amt: r.amtCarolEve}, }, { Local: m.dave, Remote: m.bob, - Param: lntemp.OpenChannelParams{Amt: r.amtDaveBob}, + Param: lntest.OpenChannelParams{Amt: r.amtDaveBob}, }, { Local: m.eve, Remote: m.bob, - Param: lntemp.OpenChannelParams{Amt: r.amtEveBob}, + Param: lntest.OpenChannelParams{Amt: r.amtEveBob}, }, } diff --git a/itest/lnd_multi-hop-error-propagation_test.go b/itest/lnd_multi-hop-error-propagation_test.go index 009c9769c..63766c738 100644 --- a/itest/lnd_multi-hop-error-propagation_test.go +++ b/itest/lnd_multi-hop-error-propagation_test.go @@ -6,12 +6,12 @@ import ( "github.com/lightningnetwork/lnd/funding" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" - "github.com/lightningnetwork/lnd/lntemp" + "github.com/lightningnetwork/lnd/lntest" "github.com/lightningnetwork/lnd/lnwire" "github.com/stretchr/testify/require" ) -func testHtlcErrorPropagation(ht *lntemp.HarnessTest) { +func testHtlcErrorPropagation(ht *lntest.HarnessTest) { // In this test we wish to exercise the daemon's correct parsing, // handling, and propagation of errors that occur while processing a // multi-hop payment. @@ -39,7 +39,7 @@ func testHtlcErrorPropagation(ht *lntemp.HarnessTest) { // and Bob. chanPointAlice := ht.OpenChannel( alice, bob, - lntemp.OpenChannelParams{Amt: chanAmt}, + lntest.OpenChannelParams{Amt: chanAmt}, ) // Next, we'll create a connection from Bob to Carol, and open a @@ -48,14 +48,14 @@ func testHtlcErrorPropagation(ht *lntemp.HarnessTest) { // above. const bobChanAmt = funding.MaxBtcFundingAmount chanPointBob := ht.OpenChannel( - bob, carol, lntemp.OpenChannelParams{Amt: chanAmt}, + bob, carol, lntest.OpenChannelParams{Amt: chanAmt}, ) // Ensure that Alice has Carol in her routing table before proceeding. ht.AssertTopologyChannelOpen(alice, chanPointBob) cType := ht.GetChannelCommitType(alice, chanPointAlice) - commitFee := lntemp.CalcStaticFee(cType, 0) + commitFee := lntest.CalcStaticFee(cType, 0) assertBaseBalance := func() { // Alice has opened a channel with Bob with zero push amount, @@ -153,24 +153,24 @@ func testHtlcErrorPropagation(ht *lntemp.HarnessTest) { assertAliceAndBob := func() { ht.AssertHtlcEventTypes( aliceEvents, routerrpc.HtlcEvent_SEND, - lntemp.HtlcEventForward, + lntest.HtlcEventForward, ) ht.AssertHtlcEventTypes( aliceEvents, routerrpc.HtlcEvent_SEND, - lntemp.HtlcEventForwardFail, + lntest.HtlcEventForwardFail, ) ht.AssertHtlcEventTypes( bobEvents, routerrpc.HtlcEvent_FORWARD, - lntemp.HtlcEventForward, + lntest.HtlcEventForward, ) ht.AssertHtlcEventTypes( bobEvents, routerrpc.HtlcEvent_FORWARD, - lntemp.HtlcEventForwardFail, + lntest.HtlcEventForwardFail, ) ht.AssertHtlcEventTypes( bobEvents, routerrpc.HtlcEvent_UNKNOWN, - lntemp.HtlcEventFinal, + lntest.HtlcEventFinal, ) } @@ -188,7 +188,7 @@ func testHtlcErrorPropagation(ht *lntemp.HarnessTest) { // There's also a final htlc event that gives the final outcome of the // htlc. ht.AssertHtlcEventTypes( - carolEvents, routerrpc.HtlcEvent_UNKNOWN, lntemp.HtlcEventFinal, + carolEvents, routerrpc.HtlcEvent_UNKNOWN, lntest.HtlcEventFinal, ) // The balances of all parties should be the same as initially since @@ -228,7 +228,7 @@ func testHtlcErrorPropagation(ht *lntemp.HarnessTest) { // There's also a final htlc event that gives the final outcome of the // htlc. ht.AssertHtlcEventTypes( - carolEvents, routerrpc.HtlcEvent_UNKNOWN, lntemp.HtlcEventFinal, + carolEvents, routerrpc.HtlcEvent_UNKNOWN, lntest.HtlcEventFinal, ) // The balances of all parties should be the same as initially since @@ -273,19 +273,19 @@ func testHtlcErrorPropagation(ht *lntemp.HarnessTest) { // settle event and a final htlc event for her receive. ht.AssertHtlcEventTypes( bobEvents, routerrpc.HtlcEvent_SEND, - lntemp.HtlcEventForward, + lntest.HtlcEventForward, ) ht.AssertHtlcEventTypes( bobEvents, routerrpc.HtlcEvent_SEND, - lntemp.HtlcEventSettle, + lntest.HtlcEventSettle, ) ht.AssertHtlcEventTypes( carolEvents, routerrpc.HtlcEvent_RECEIVE, - lntemp.HtlcEventSettle, + lntest.HtlcEventSettle, ) ht.AssertHtlcEventTypes( carolEvents, routerrpc.HtlcEvent_UNKNOWN, - lntemp.HtlcEventFinal, + lntest.HtlcEventFinal, ) amtSent += toSend @@ -316,11 +316,11 @@ func testHtlcErrorPropagation(ht *lntemp.HarnessTest) { // Alice should have a forwarding event and a forwarding failure. ht.AssertHtlcEventTypes( aliceEvents, routerrpc.HtlcEvent_SEND, - lntemp.HtlcEventForward, + lntest.HtlcEventForward, ) ht.AssertHtlcEventTypes( aliceEvents, routerrpc.HtlcEvent_SEND, - lntemp.HtlcEventForwardFail, + lntest.HtlcEventForwardFail, ) // Bob should have a link failure because the htlc failed on his @@ -331,7 +331,7 @@ func testHtlcErrorPropagation(ht *lntemp.HarnessTest) { // There's also a final htlc event that gives the final outcome of the // htlc. ht.AssertHtlcEventTypes( - bobEvents, routerrpc.HtlcEvent_UNKNOWN, lntemp.HtlcEventFinal, + bobEvents, routerrpc.HtlcEvent_UNKNOWN, lntest.HtlcEventFinal, ) // Generate new invoice to not pay same invoice twice. @@ -362,11 +362,11 @@ func testHtlcErrorPropagation(ht *lntemp.HarnessTest) { // Alice should have a forwarding event and subsequent fail. ht.AssertHtlcEventTypes( aliceEvents, routerrpc.HtlcEvent_SEND, - lntemp.HtlcEventForward, + lntest.HtlcEventForward, ) ht.AssertHtlcEventTypes( aliceEvents, routerrpc.HtlcEvent_SEND, - lntemp.HtlcEventForwardFail, + lntest.HtlcEventForwardFail, ) // Bob should have a link failure because he could not find the next @@ -377,7 +377,7 @@ func testHtlcErrorPropagation(ht *lntemp.HarnessTest) { // There's also a final htlc event that gives the final outcome of the // htlc. ht.AssertHtlcEventTypes( - bobEvents, routerrpc.HtlcEvent_UNKNOWN, lntemp.HtlcEventFinal, + bobEvents, routerrpc.HtlcEvent_UNKNOWN, lntest.HtlcEventFinal, ) // Finally, immediately close the channel. This function will also diff --git a/itest/lnd_multi-hop-payments_test.go b/itest/lnd_multi-hop-payments_test.go index 3baec46af..30a446471 100644 --- a/itest/lnd_multi-hop-payments_test.go +++ b/itest/lnd_multi-hop-payments_test.go @@ -5,12 +5,12 @@ import ( "github.com/lightningnetwork/lnd/chainreg" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/stretchr/testify/require" ) -func testMultiHopPayments(ht *lntemp.HarnessTest) { +func testMultiHopPayments(ht *lntest.HarnessTest) { const chanAmt = btcutil.Amount(100000) // As preliminary setup, we'll create two new nodes: Carol and Dave, @@ -43,21 +43,21 @@ func testMultiHopPayments(ht *lntemp.HarnessTest) { // Open a channel with 100k satoshis between Alice and Bob with Alice // being the sole funder of the channel. chanPointAlice := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{Amt: chanAmt}, + alice, bob, lntest.OpenChannelParams{Amt: chanAmt}, ) // We'll create Dave and establish a channel to Alice. Dave will be // running an older node that requires the legacy onion payload. ht.FundCoins(btcutil.SatoshiPerBitcoin, dave) chanPointDave := ht.OpenChannel( - dave, alice, lntemp.OpenChannelParams{Amt: chanAmt}, + dave, alice, lntest.OpenChannelParams{Amt: chanAmt}, ) // Next, we'll create Carol and establish a channel to from her to // Dave. ht.FundCoins(btcutil.SatoshiPerBitcoin, carol) chanPointCarol := ht.OpenChannel( - carol, dave, lntemp.OpenChannelParams{Amt: chanAmt}, + carol, dave, lntest.OpenChannelParams{Amt: chanAmt}, ) // Create 5 invoices for Bob, which expect a payment from Carol for 1k @@ -69,7 +69,7 @@ func testMultiHopPayments(ht *lntemp.HarnessTest) { // Set the fee policies of the Alice -> Bob and the Dave -> Alice // channel edges to relatively large non default values. This makes it // possible to pick up more subtle fee calculation errors. - maxHtlc := lntemp.CalculateMaxHtlc(chanAmt) + maxHtlc := lntest.CalculateMaxHtlc(chanAmt) const aliceBaseFeeSat = 1 const aliceFeeRatePPM = 100000 updateChannelPolicy( @@ -222,7 +222,7 @@ func testMultiHopPayments(ht *lntemp.HarnessTest) { // policy update. // // NOTE: only used in current test. -func updateChannelPolicy(ht *lntemp.HarnessTest, hn *node.HarnessNode, +func updateChannelPolicy(ht *lntest.HarnessTest, hn *node.HarnessNode, chanPoint *lnrpc.ChannelPoint, baseFee int64, feeRate int64, timeLockDelta uint32, maxHtlc uint64, listenerNode *node.HarnessNode) { diff --git a/itest/lnd_multi-hop_test.go b/itest/lnd_multi-hop_test.go index c156cf482..f47031635 100644 --- a/itest/lnd_multi-hop_test.go +++ b/itest/lnd_multi-hop_test.go @@ -12,9 +12,9 @@ import ( "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/invoicesrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" - "github.com/lightningnetwork/lnd/lntemp/rpc" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" + "github.com/lightningnetwork/lnd/lntest/rpc" "github.com/lightningnetwork/lnd/lntypes" "github.com/lightningnetwork/lnd/routing" "github.com/stretchr/testify/require" @@ -52,12 +52,12 @@ var commitWithZeroConf = []struct { } // caseRunner defines a single test case runner. -type caseRunner func(ht *lntemp.HarnessTest, alice, bob *node.HarnessNode, +type caseRunner func(ht *lntest.HarnessTest, alice, bob *node.HarnessNode, c lnrpc.CommitmentType, zeroConf bool) // runMultiHopHtlcClaimTest is a helper method to build test cases based on // different commitment types and zero-conf config and run them. -func runMultiHopHtlcClaimTest(ht *lntemp.HarnessTest, tester caseRunner) { +func runMultiHopHtlcClaimTest(ht *lntest.HarnessTest, tester caseRunner) { for _, typeAndConf := range commitWithZeroConf { typeAndConf := typeAndConf name := fmt.Sprintf("zeroconf=%v/committype=%v", @@ -65,7 +65,7 @@ func runMultiHopHtlcClaimTest(ht *lntemp.HarnessTest, tester caseRunner) { // Create the nodes here so that separate logs will be created // for Alice and Bob. - args := lntemp.NodeArgsForCommitType(typeAndConf.commitType) + args := lntest.NodeArgsForCommitType(typeAndConf.commitType) if typeAndConf.zeroConf { args = append( args, "--protocol.option-scid-alias", @@ -103,11 +103,11 @@ func runMultiHopHtlcClaimTest(ht *lntemp.HarnessTest, tester caseRunner) { // it using the HTLC timeout transaction. Any dust HTLC's should be immediately // canceled backwards. Once the timeout has been reached, then we should sweep // it on-chain, and cancel the HTLC backwards. -func testMultiHopHtlcLocalTimeout(ht *lntemp.HarnessTest) { +func testMultiHopHtlcLocalTimeout(ht *lntest.HarnessTest) { runMultiHopHtlcClaimTest(ht, runMultiHopHtlcLocalTimeout) } -func runMultiHopHtlcLocalTimeout(ht *lntemp.HarnessTest, +func runMultiHopHtlcLocalTimeout(ht *lntest.HarnessTest, alice, bob *node.HarnessNode, c lnrpc.CommitmentType, zeroConf bool) { // First, we'll create a three hop network: Alice -> Bob -> Carol, with @@ -171,7 +171,7 @@ func runMultiHopHtlcLocalTimeout(ht *lntemp.HarnessTest, // Bob's force close transaction should now be found in the mempool. If // there are anchors, we also expect Bob's anchor sweep. expectedTxes := 1 - hasAnchors := lntemp.CommitTypeHasAnchors(c) + hasAnchors := lntest.CommitTypeHasAnchors(c) if hasAnchors { expectedTxes = 2 } @@ -272,11 +272,11 @@ func runMultiHopHtlcLocalTimeout(ht *lntemp.HarnessTest, // transaction. In this scenario, the node that sent the outgoing HTLC should // extract the preimage from the sweep transaction, and finish settling the // HTLC backwards into the route. -func testMultiHopReceiverChainClaim(ht *lntemp.HarnessTest) { +func testMultiHopReceiverChainClaim(ht *lntest.HarnessTest) { runMultiHopHtlcClaimTest(ht, runMultiHopReceiverChainClaim) } -func runMultiHopReceiverChainClaim(ht *lntemp.HarnessTest, +func runMultiHopReceiverChainClaim(ht *lntest.HarnessTest, alice, bob *node.HarnessNode, c lnrpc.CommitmentType, zeroConf bool) { // First, we'll create a three hop network: Alice -> Bob -> Carol, with @@ -348,7 +348,7 @@ func runMultiHopReceiverChainClaim(ht *lntemp.HarnessTest, // transaction in order to go to the chain and sweep her HTLC. If there // are anchors, Carol also sweeps hers. expectedTxes := 1 - hasAnchors := lntemp.CommitTypeHasAnchors(c) + hasAnchors := lntest.CommitTypeHasAnchors(c) if hasAnchors { expectedTxes = 2 } @@ -470,13 +470,13 @@ func runMultiHopReceiverChainClaim(ht *lntemp.HarnessTest, // commitment on-chain early, then it eventually recognizes this HTLC as one // that's timed out. At this point, the node should timeout the HTLC using the // HTLC timeout transaction, then cancel it backwards as normal. -func testMultiHopLocalForceCloseOnChainHtlcTimeout(ht *lntemp.HarnessTest) { +func testMultiHopLocalForceCloseOnChainHtlcTimeout(ht *lntest.HarnessTest) { runMultiHopHtlcClaimTest( ht, runMultiHopLocalForceCloseOnChainHtlcTimeout, ) } -func runMultiHopLocalForceCloseOnChainHtlcTimeout(ht *lntemp.HarnessTest, +func runMultiHopLocalForceCloseOnChainHtlcTimeout(ht *lntest.HarnessTest, alice, bob *node.HarnessNode, c lnrpc.CommitmentType, zeroConf bool) { // First, we'll create a three hop network: Alice -> Bob -> Carol, with @@ -517,7 +517,7 @@ func runMultiHopLocalForceCloseOnChainHtlcTimeout(ht *lntemp.HarnessTest, // Now that all parties have the HTLC locked in, we'll immediately // force close the Bob -> Carol channel. This should trigger contract // resolution mode for both of them. - hasAnchors := lntemp.CommitTypeHasAnchors(c) + hasAnchors := lntest.CommitTypeHasAnchors(c) stream, _ := ht.CloseChannelAssertPending(bob, bobChanPoint, true) closeTx := ht.AssertStreamChannelForceClosed( bob, bobChanPoint, hasAnchors, stream, @@ -626,13 +626,13 @@ func runMultiHopLocalForceCloseOnChainHtlcTimeout(ht *lntemp.HarnessTest, // channel, then we properly timeout the HTLC directly on *their* commitment // transaction once the timeout has expired. Once we sweep the transaction, we // should also cancel back the initial HTLC. -func testMultiHopRemoteForceCloseOnChainHtlcTimeout(ht *lntemp.HarnessTest) { +func testMultiHopRemoteForceCloseOnChainHtlcTimeout(ht *lntest.HarnessTest) { runMultiHopHtlcClaimTest( ht, runMultiHopRemoteForceCloseOnChainHtlcTimeout, ) } -func runMultiHopRemoteForceCloseOnChainHtlcTimeout(ht *lntemp.HarnessTest, +func runMultiHopRemoteForceCloseOnChainHtlcTimeout(ht *lntest.HarnessTest, alice, bob *node.HarnessNode, c lnrpc.CommitmentType, zeroConf bool) { // First, we'll create a three hop network: Alice -> Bob -> Carol, with @@ -682,7 +682,7 @@ func runMultiHopRemoteForceCloseOnChainHtlcTimeout(ht *lntemp.HarnessTest, // transaction. This will let us exercise that Bob is able to sweep the // expired HTLC on Carol's version of the commitment transaction. If // Carol has an anchor, it will be swept too. - hasAnchors := lntemp.CommitTypeHasAnchors(c) + hasAnchors := lntest.CommitTypeHasAnchors(c) closeStream, _ := ht.CloseChannelAssertPending( carol, bobChanPoint, true, ) @@ -782,11 +782,11 @@ func runMultiHopRemoteForceCloseOnChainHtlcTimeout(ht *lntemp.HarnessTest, // we force close a channel with an incoming HTLC, and later find out the // preimage via the witness beacon, we properly settle the HTLC on-chain using // the HTLC success transaction in order to ensure we don't lose any funds. -func testMultiHopHtlcLocalChainClaim(ht *lntemp.HarnessTest) { +func testMultiHopHtlcLocalChainClaim(ht *lntest.HarnessTest) { runMultiHopHtlcClaimTest(ht, runMultiHopHtlcLocalChainClaim) } -func runMultiHopHtlcLocalChainClaim(ht *lntemp.HarnessTest, +func runMultiHopHtlcLocalChainClaim(ht *lntest.HarnessTest, alice, bob *node.HarnessNode, c lnrpc.CommitmentType, zeroConf bool) { // First, we'll create a three hop network: Alice -> Bob -> Carol, with @@ -840,7 +840,7 @@ func runMultiHopHtlcLocalChainClaim(ht *lntemp.HarnessTest, // At this point, Bob decides that he wants to exit the channel // immediately, so he force closes his commitment transaction. - hasAnchors := lntemp.CommitTypeHasAnchors(c) + hasAnchors := lntest.CommitTypeHasAnchors(c) closeStream, _ := ht.CloseChannelAssertPending( bob, aliceChanPoint, true, ) @@ -888,7 +888,7 @@ func runMultiHopHtlcLocalChainClaim(ht *lntemp.HarnessTest, // Carol's commitment transaction should now be in the mempool. If // there is an anchor, Carol will sweep that too. - if lntemp.CommitTypeHasAnchors(c) { + if lntest.CommitTypeHasAnchors(c) { expectedTxes = 2 } ht.Miner.AssertNumTxsInMempool(expectedTxes) @@ -1076,11 +1076,11 @@ func runMultiHopHtlcLocalChainClaim(ht *lntemp.HarnessTest, // we found out the preimage via the witness beacon, we properly settle the // HTLC directly on-chain using the preimage in order to ensure that we don't // lose any funds. -func testMultiHopHtlcRemoteChainClaim(ht *lntemp.HarnessTest) { +func testMultiHopHtlcRemoteChainClaim(ht *lntest.HarnessTest) { runMultiHopHtlcClaimTest(ht, runMultiHopHtlcRemoteChainClaim) } -func runMultiHopHtlcRemoteChainClaim(ht *lntemp.HarnessTest, +func runMultiHopHtlcRemoteChainClaim(ht *lntest.HarnessTest, alice, bob *node.HarnessNode, c lnrpc.CommitmentType, zeroConf bool) { // First, we'll create a three hop network: Alice -> Bob -> Carol, with @@ -1135,7 +1135,7 @@ func runMultiHopHtlcRemoteChainClaim(ht *lntemp.HarnessTest, // Next, Alice decides that she wants to exit the channel, so she'll // immediately force close the channel by broadcast her commitment // transaction. - hasAnchors := lntemp.CommitTypeHasAnchors(c) + hasAnchors := lntest.CommitTypeHasAnchors(c) closeStream, _ := ht.CloseChannelAssertPending( alice, aliceChanPoint, true, ) @@ -1346,11 +1346,11 @@ func runMultiHopHtlcRemoteChainClaim(ht *lntemp.HarnessTest, // resolve them using the second level timeout and success transactions. In // case of anchor channels, the second-level spends can also be aggregated and // properly feebumped, so we'll check that as well. -func testMultiHopHtlcAggregation(ht *lntemp.HarnessTest) { +func testMultiHopHtlcAggregation(ht *lntest.HarnessTest) { runMultiHopHtlcClaimTest(ht, runMultiHopHtlcAggregation) } -func runMultiHopHtlcAggregation(ht *lntemp.HarnessTest, +func runMultiHopHtlcAggregation(ht *lntest.HarnessTest, alice, bob *node.HarnessNode, c lnrpc.CommitmentType, zeroConf bool) { // First, we'll create a three hop network: Alice -> Bob -> Carol. @@ -1489,7 +1489,7 @@ func runMultiHopHtlcAggregation(ht *lntemp.HarnessTest, // Bob's force close transaction should now be found in the mempool. If // there are anchors, we also expect Bob's anchor sweep. - hasAnchors := lntemp.CommitTypeHasAnchors(c) + hasAnchors := lntest.CommitTypeHasAnchors(c) expectedTxes := 1 if hasAnchors { expectedTxes = 2 @@ -1728,7 +1728,7 @@ func runMultiHopHtlcAggregation(ht *lntemp.HarnessTest, } // createThreeHopNetwork creates a topology of `Alice -> Bob -> Carol`. -func createThreeHopNetwork(ht *lntemp.HarnessTest, +func createThreeHopNetwork(ht *lntest.HarnessTest, alice, bob *node.HarnessNode, carolHodl bool, c lnrpc.CommitmentType, zeroConf bool) (*lnrpc.ChannelPoint, *lnrpc.ChannelPoint, *node.HarnessNode) { @@ -1738,7 +1738,7 @@ func createThreeHopNetwork(ht *lntemp.HarnessTest, // We'll create a new node "carol" and have Bob connect to her. // If the carolHodl flag is set, we'll make carol always hold onto the // HTLC, this way it'll force Bob to go to chain to resolve the HTLC. - carolFlags := lntemp.NodeArgsForCommitType(c) + carolFlags := lntest.NodeArgsForCommitType(c) if carolHodl { carolFlags = append(carolFlags, "--hodl.exit-settle") } @@ -1790,7 +1790,7 @@ func createThreeHopNetwork(ht *lntemp.HarnessTest, go acceptChannel(ht.T, true, acceptStream) } - aliceParams := lntemp.OpenChannelParams{ + aliceParams := lntest.OpenChannelParams{ Amt: chanAmt, CommitmentType: c, FundingShim: aliceFundingShim, @@ -1819,7 +1819,7 @@ func createThreeHopNetwork(ht *lntemp.HarnessTest, go acceptChannel(ht.T, true, acceptStream) } - bobParams := lntemp.OpenChannelParams{ + bobParams := lntest.OpenChannelParams{ Amt: chanAmt, CommitmentType: c, FundingShim: bobFundingShim, diff --git a/itest/lnd_network_test.go b/itest/lnd_network_test.go index 9244484a6..725d1b055 100644 --- a/itest/lnd_network_test.go +++ b/itest/lnd_network_test.go @@ -6,8 +6,8 @@ import ( "github.com/lightningnetwork/lnd/lncfg" "github.com/lightningnetwork/lnd/lnrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/lntest/wait" "github.com/stretchr/testify/require" ) @@ -15,7 +15,7 @@ import ( // testNetworkConnectionTimeout checks that the connectiontimeout is taking // effect. It creates a node with a small connection timeout value, and // connects it to a non-routable IP address. -func testNetworkConnectionTimeout(ht *lntemp.HarnessTest) { +func testNetworkConnectionTimeout(ht *lntest.HarnessTest) { var ( // testPub is a random public key for testing only. testPub = "0332bda7da70fefe4b6ab92f53b3c4f4ee7999" + @@ -74,7 +74,7 @@ func testNetworkConnectionTimeout(ht *lntemp.HarnessTest) { // testReconnectAfterIPChange verifies that if a persistent inbound node changes // its listening address then it's peer will still be able to reconnect to it. -func testReconnectAfterIPChange(ht *lntemp.HarnessTest) { +func testReconnectAfterIPChange(ht *lntest.HarnessTest) { // In this test, the following network will be set up. A single // dash line represents a peer connection and a double dash line // represents a channel. @@ -126,7 +126,7 @@ func testReconnectAfterIPChange(ht *lntemp.HarnessTest) { // ensures that Charlie receives the node announcement from Alice as // part of the announcement broadcast. chanPoint := ht.OpenChannel( - alice, dave, lntemp.OpenChannelParams{Amt: 1000000}, + alice, dave, lntest.OpenChannelParams{Amt: 1000000}, ) // waitForNodeAnnouncement is a closure used to wait on the given graph @@ -209,7 +209,7 @@ func testReconnectAfterIPChange(ht *lntemp.HarnessTest) { // testAddPeerConfig tests that the "--addpeer" config flag successfully adds // a new peer. -func testAddPeerConfig(ht *lntemp.HarnessTest) { +func testAddPeerConfig(ht *lntest.HarnessTest) { alice := ht.Alice info := alice.RPC.GetInfo() diff --git a/itest/lnd_neutrino_test.go b/itest/lnd_neutrino_test.go index acf56f9d8..2c551362a 100644 --- a/itest/lnd_neutrino_test.go +++ b/itest/lnd_neutrino_test.go @@ -2,13 +2,13 @@ package itest import ( "github.com/lightningnetwork/lnd/lnrpc/neutrinorpc" - "github.com/lightningnetwork/lnd/lntemp" + "github.com/lightningnetwork/lnd/lntest" "github.com/stretchr/testify/require" ) // testNeutrino checks that the neutrino sub-server can fetch compact // block filters, server status and connect to a connected peer. -func testNeutrino(ht *lntemp.HarnessTest) { +func testNeutrino(ht *lntest.HarnessTest) { if !ht.IsNeutrinoBackend() { ht.Skipf("skipping test for non neutrino backends") } diff --git a/itest/lnd_no_etcd_dummy_failover_test.go b/itest/lnd_no_etcd_dummy_failover_test.go index 721b60cf6..2d731febc 100644 --- a/itest/lnd_no_etcd_dummy_failover_test.go +++ b/itest/lnd_no_etcd_dummy_failover_test.go @@ -3,8 +3,8 @@ package itest -import "github.com/lightningnetwork/lnd/lntemp" +import "github.com/lightningnetwork/lnd/lntest" // testEtcdFailover is an empty itest when LND is not compiled with etcd // support. -func testEtcdFailover(ht *lntemp.HarnessTest) {} +func testEtcdFailover(ht *lntest.HarnessTest) {} diff --git a/itest/lnd_nonstd_sweep_test.go b/itest/lnd_nonstd_sweep_test.go index cc2ac7027..a85fbc786 100644 --- a/itest/lnd_nonstd_sweep_test.go +++ b/itest/lnd_nonstd_sweep_test.go @@ -5,11 +5,11 @@ import ( "github.com/btcsuite/btcd/btcutil" "github.com/lightningnetwork/lnd/lnrpc" - "github.com/lightningnetwork/lnd/lntemp" + "github.com/lightningnetwork/lnd/lntest" "github.com/stretchr/testify/require" ) -func testNonstdSweep(ht *lntemp.HarnessTest) { +func testNonstdSweep(ht *lntest.HarnessTest) { p2shAddr, err := btcutil.NewAddressScriptHash( make([]byte, 1), harnessNetParams, ) @@ -74,7 +74,7 @@ func testNonstdSweep(ht *lntemp.HarnessTest) { } } -func testNonStdSweepInner(ht *lntemp.HarnessTest, address string) { +func testNonStdSweepInner(ht *lntest.HarnessTest, address string) { carol := ht.NewNode("carol", nil) // Give Carol a UTXO so SendCoins will behave as expected. diff --git a/itest/lnd_onchain_test.go b/itest/lnd_onchain_test.go index 2d56d2429..a95b2f325 100644 --- a/itest/lnd_onchain_test.go +++ b/itest/lnd_onchain_test.go @@ -11,8 +11,8 @@ import ( "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/chainrpc" "github.com/lightningnetwork/lnd/lnrpc/walletrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/lntest/wait" "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/sweep" @@ -20,7 +20,7 @@ import ( ) // testChainKit tests ChainKit RPC endpoints. -func testChainKit(ht *lntemp.HarnessTest) { +func testChainKit(ht *lntest.HarnessTest) { // Test functions registered as test cases spin up separate nodes // during execution. By calling sub-test functions as seen below we // avoid the need to start separate nodes. @@ -30,7 +30,7 @@ func testChainKit(ht *lntemp.HarnessTest) { // testChainKitGetBlock ensures that given a block hash, the RPC endpoint // returns the correct target block. -func testChainKitGetBlock(ht *lntemp.HarnessTest) { +func testChainKitGetBlock(ht *lntest.HarnessTest) { // Get best block hash. bestBlockRes := ht.Alice.RPC.GetBestBlock(nil) @@ -58,7 +58,7 @@ func testChainKitGetBlock(ht *lntemp.HarnessTest) { // testChainKitGetBlockHash ensures that given a block height, the RPC endpoint // returns the correct target block hash. -func testChainKitGetBlockHash(ht *lntemp.HarnessTest) { +func testChainKitGetBlockHash(ht *lntest.HarnessTest) { // Get best block hash. bestBlockRes := ht.Alice.RPC.GetBestBlock(nil) @@ -78,13 +78,13 @@ func testChainKitGetBlockHash(ht *lntemp.HarnessTest) { // rate by broadcasting a Child-Pays-For-Parent (CPFP) transaction. // // TODO(wilmer): Add RBF case once btcd supports it. -func testCPFP(ht *lntemp.HarnessTest) { +func testCPFP(ht *lntest.HarnessTest) { runCPFP(ht, ht.Alice, ht.Bob) } // runCPFP ensures that the daemon can bump an unconfirmed transaction's fee // rate by broadcasting a Child-Pays-For-Parent (CPFP) transaction. -func runCPFP(ht *lntemp.HarnessTest, alice, bob *node.HarnessNode) { +func runCPFP(ht *lntest.HarnessTest, alice, bob *node.HarnessNode) { // Skip this test for neutrino, as it's not aware of mempool // transactions. if ht.IsNeutrinoBackend() { @@ -180,9 +180,9 @@ func runCPFP(ht *lntemp.HarnessTest, alice, bob *node.HarnessNode) { // testAnchorReservedValue tests that we won't allow sending transactions when // that would take the value we reserve for anchor fee bumping out of our // wallet. -func testAnchorReservedValue(ht *lntemp.HarnessTest) { +func testAnchorReservedValue(ht *lntest.HarnessTest) { // Start two nodes supporting anchor channels. - args := lntemp.NodeArgsForCommitType(lnrpc.CommitmentType_ANCHORS) + args := lntest.NodeArgsForCommitType(lnrpc.CommitmentType_ANCHORS) // NOTE: we cannot reuse the standby node here as the test requires the // node to start with no UTXOs. @@ -203,7 +203,7 @@ func testAnchorReservedValue(ht *lntemp.HarnessTest) { // wallet, without a change output. This should not be allowed. ht.OpenChannelAssertErr( - alice, bob, lntemp.OpenChannelParams{ + alice, bob, lntest.OpenChannelParams{ Amt: chanAmt, }, lnwallet.ErrReservedValueInvalidated, ) @@ -211,13 +211,13 @@ func testAnchorReservedValue(ht *lntemp.HarnessTest) { // Alice opens a smaller channel. This works since it will have a // change output. chanPoint1 := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{Amt: chanAmt / 4}, + alice, bob, lntest.OpenChannelParams{Amt: chanAmt / 4}, ) // If Alice tries to open another anchor channel to Bob, Bob should not // reject it as he is not contributing any funds. chanPoint2 := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{Amt: chanAmt / 4}, + alice, bob, lntest.OpenChannelParams{Amt: chanAmt / 4}, ) // Similarly, if Alice tries to open a legacy channel to Bob, Bob @@ -229,7 +229,7 @@ func testAnchorReservedValue(ht *lntemp.HarnessTest) { ht.EnsureConnected(alice, bob) chanPoint3 := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{Amt: chanAmt / 4}, + alice, bob, lntest.OpenChannelParams{Amt: chanAmt / 4}, ) chanPoints := []*lnrpc.ChannelPoint{chanPoint1, chanPoint2, chanPoint3} @@ -347,13 +347,13 @@ func testAnchorReservedValue(ht *lntemp.HarnessTest) { // testAnchorThirdPartySpend tests that if we force close a channel, but then // don't sweep the anchor in time and a 3rd party spends it, that we remove any // transactions that are a descendent of that sweep. -func testAnchorThirdPartySpend(ht *lntemp.HarnessTest) { +func testAnchorThirdPartySpend(ht *lntest.HarnessTest) { // First, we'll create two new nodes that both default to anchor // channels. // // NOTE: The itests differ here as anchors is default off vs the normal // lnd binary. - args := lntemp.NodeArgsForCommitType(lnrpc.CommitmentType_ANCHORS) + args := lntest.NodeArgsForCommitType(lnrpc.CommitmentType_ANCHORS) alice := ht.NewNode("Alice", args) defer ht.Shutdown(alice) @@ -374,7 +374,7 @@ func testAnchorThirdPartySpend(ht *lntemp.HarnessTest) { // Open the channel between the two nodes and wait for it to confirm // fully. aliceChanPoint1 := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{ + alice, bob, lntest.OpenChannelParams{ Amt: firstChanSize, }, ) @@ -493,7 +493,7 @@ func testAnchorThirdPartySpend(ht *lntemp.HarnessTest) { // assertAnchorOutputLost asserts that the anchor output for the given channel // has the state of being lost. -func assertAnchorOutputLost(ht *lntemp.HarnessTest, hn *node.HarnessNode, +func assertAnchorOutputLost(ht *lntest.HarnessTest, hn *node.HarnessNode, chanPoint *lnrpc.ChannelPoint) { cp := ht.OutPointFromChannelPoint(chanPoint) @@ -527,8 +527,8 @@ func assertAnchorOutputLost(ht *lntemp.HarnessTest, hn *node.HarnessNode, // genAnchorSweep generates a "3rd party" anchor sweeping from an existing one. // In practice, we just re-use the existing witness, and track on our own // output producing a 1-in-1-out transaction. -func genAnchorSweep(ht *lntemp.HarnessTest, - aliceAnchor *lntemp.SweptOutput, anchorCsv uint32) *btcutil.Tx { +func genAnchorSweep(ht *lntest.HarnessTest, + aliceAnchor *lntest.SweptOutput, anchorCsv uint32) *btcutil.Tx { // At this point, we have the transaction that Alice used to try to // sweep her anchor. As this is actually just something anyone can diff --git a/itest/lnd_open_channel_test.go b/itest/lnd_open_channel_test.go index 06f8817e1..bfe80cbd1 100644 --- a/itest/lnd_open_channel_test.go +++ b/itest/lnd_open_channel_test.go @@ -10,9 +10,9 @@ import ( "github.com/lightningnetwork/lnd/chainreg" "github.com/lightningnetwork/lnd/funding" "github.com/lightningnetwork/lnd/lnrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" - "github.com/lightningnetwork/lnd/lntemp/rpc" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" + "github.com/lightningnetwork/lnd/lntest/rpc" "github.com/lightningnetwork/lnd/lntest/wait" "github.com/stretchr/testify/require" ) @@ -20,7 +20,7 @@ import ( // testOpenChannelAfterReorg tests that in the case where we have an open // channel where the funding tx gets reorged out, the channel will no // longer be present in the node's routing table. -func testOpenChannelAfterReorg(ht *lntemp.HarnessTest) { +func testOpenChannelAfterReorg(ht *lntest.HarnessTest) { // Skip test for neutrino, as we cannot disconnect the miner at will. // TODO(halseth): remove when either can disconnect at will, or restart // node with connection to new miner. @@ -33,7 +33,7 @@ func testOpenChannelAfterReorg(ht *lntemp.HarnessTest) { // Set up a new miner that we can use to cause a reorg. tempLogDir := ".tempminerlogs" logFilename := "output-open_channel_reorg-temp_miner.log" - tempMiner := lntemp.NewTempMiner( + tempMiner := lntest.NewTempMiner( ht.Context(), ht.T, tempLogDir, logFilename, ) defer tempMiner.Stop() @@ -68,7 +68,7 @@ func testOpenChannelAfterReorg(ht *lntemp.HarnessTest) { // Create a new channel that requires 1 confs before it's considered // open, then broadcast the funding transaction - params := lntemp.OpenChannelParams{ + params := lntest.OpenChannelParams{ Amt: funding.MaxBtcFundingAmount, Private: true, } @@ -172,7 +172,7 @@ func testOpenChannelAfterReorg(ht *lntemp.HarnessTest) { // ChannelUpdate --> defaultBaseFee, provided FeeRate // 4.) baseFee and feeRate provided to OpenChannelRequest // ChannelUpdate --> provided baseFee, provided feeRate. -func testOpenChannelUpdateFeePolicy(ht *lntemp.HarnessTest) { +func testOpenChannelUpdateFeePolicy(ht *lntest.HarnessTest) { const ( defaultBaseFee = 1000 defaultFeeRate = 1 @@ -182,12 +182,12 @@ func testOpenChannelUpdateFeePolicy(ht *lntemp.HarnessTest) { optionalFeeRate = 1337 ) - defaultMaxHtlc := lntemp.CalculateMaxHtlc(funding.MaxBtcFundingAmount) + defaultMaxHtlc := lntest.CalculateMaxHtlc(funding.MaxBtcFundingAmount) chanAmt := funding.MaxBtcFundingAmount pushAmt := chanAmt / 2 - feeScenarios := []lntemp.OpenChannelParams{ + feeScenarios := []lntest.OpenChannelParams{ { Amt: chanAmt, PushAmt: pushAmt, @@ -259,8 +259,8 @@ func testOpenChannelUpdateFeePolicy(ht *lntemp.HarnessTest) { alice, bob := ht.Alice, ht.Bob - runTestCase := func(ht *lntemp.HarnessTest, - fs lntemp.OpenChannelParams, + runTestCase := func(ht *lntest.HarnessTest, + fs lntest.OpenChannelParams, alicePolicy, bobPolicy *lnrpc.RoutingPolicy) { // Create a channel Alice->Bob. @@ -305,14 +305,14 @@ func testOpenChannelUpdateFeePolicy(ht *lntemp.HarnessTest) { // testBasicChannelCreationAndUpdates tests multiple channel opening and // closing, and ensures that if a node is subscribed to channel updates they // will be received correctly for both cooperative and force closed channels. -func testBasicChannelCreationAndUpdates(ht *lntemp.HarnessTest) { +func testBasicChannelCreationAndUpdates(ht *lntest.HarnessTest) { runBasicChannelCreationAndUpdates(ht, ht.Alice, ht.Bob) } // runBasicChannelCreationAndUpdates tests multiple channel opening and closing, // and ensures that if a node is subscribed to channel updates they will be // received correctly for both cooperative and force closed channels. -func runBasicChannelCreationAndUpdates(ht *lntemp.HarnessTest, +func runBasicChannelCreationAndUpdates(ht *lntest.HarnessTest, alice, bob *node.HarnessNode) { const ( @@ -329,7 +329,7 @@ func runBasicChannelCreationAndUpdates(ht *lntemp.HarnessTest, chanPoints := make([]*lnrpc.ChannelPoint, numChannels) for i := 0; i < numChannels; i++ { chanPoints[i] = ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{ + alice, bob, lntest.OpenChannelParams{ Amt: amount, }, ) @@ -458,8 +458,8 @@ func runBasicChannelCreationAndUpdates(ht *lntemp.HarnessTest, // assertMinerBlockHeightDelta ensures that tempMiner is 'delta' blocks ahead // of miner. -func assertMinerBlockHeightDelta(ht *lntemp.HarnessTest, - miner, tempMiner *lntemp.HarnessMiner, delta int32) { +func assertMinerBlockHeightDelta(ht *lntest.HarnessTest, + miner, tempMiner *lntest.HarnessMiner, delta int32) { // Ensure the chain lengths are what we expect. err := wait.NoError(func() error { diff --git a/itest/lnd_payment_test.go b/itest/lnd_payment_test.go index 754c7e937..e8986f363 100644 --- a/itest/lnd_payment_test.go +++ b/itest/lnd_payment_test.go @@ -10,13 +10,13 @@ import ( "github.com/lightningnetwork/lnd/input" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/lntest/wait" "github.com/stretchr/testify/require" ) -func testListPayments(ht *lntemp.HarnessTest) { +func testListPayments(ht *lntest.HarnessTest) { alice, bob := ht.Alice, ht.Bob // Check that there are no payments before test. @@ -26,7 +26,7 @@ func testListPayments(ht *lntemp.HarnessTest) { // being the sole funder of the channel. chanAmt := btcutil.Amount(100000) chanPoint := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{Amt: chanAmt}, + alice, bob, lntest.OpenChannelParams{Amt: chanAmt}, ) // Get the number of invoices Bob already has. @@ -169,13 +169,13 @@ func testListPayments(ht *lntemp.HarnessTest) { // subsystems trying to update the channel state in the db. We follow this // transition with a payment that updates the commitment state and verify that // the pending state is up to date. -func testPaymentFollowingChannelOpen(ht *lntemp.HarnessTest) { +func testPaymentFollowingChannelOpen(ht *lntest.HarnessTest) { const paymentAmt = btcutil.Amount(100) channelCapacity := paymentAmt * 1000 // We first establish a channel between Alice and Bob. alice, bob := ht.Alice, ht.Bob - p := lntemp.OpenChannelParams{ + p := lntest.OpenChannelParams{ Amt: channelCapacity, } pendingUpdate := ht.OpenChannelAssertPending(alice, bob, p) @@ -196,7 +196,7 @@ func testPaymentFollowingChannelOpen(ht *lntemp.HarnessTest) { ht.MineBlocksAndAssertNumTxes(6, 1) // We verify that the channel is open from both nodes point of view. - chanPoint := lntemp.ChanPointFromPendingUpdate(pendingUpdate) + chanPoint := lntest.ChanPointFromPendingUpdate(pendingUpdate) ht.AssertNodesNumPendingOpenChannels(alice, bob, 0) ht.AssertChannelExists(alice, chanPoint) ht.AssertChannelExists(bob, chanPoint) @@ -224,7 +224,7 @@ func testPaymentFollowingChannelOpen(ht *lntemp.HarnessTest) { } // testAsyncPayments tests the performance of the async payments. -func testAsyncPayments(ht *lntemp.HarnessTest) { +func testAsyncPayments(ht *lntest.HarnessTest) { // We use new nodes here as the benchmark test creates lots of data // which can be costly to be carried on. alice := ht.NewNode("Alice", []string{"--pending-commit-interval=3m"}) @@ -237,7 +237,7 @@ func testAsyncPayments(ht *lntemp.HarnessTest) { } // runAsyncPayments tests the performance of the async payments. -func runAsyncPayments(ht *lntemp.HarnessTest, alice, bob *node.HarnessNode) { +func runAsyncPayments(ht *lntest.HarnessTest, alice, bob *node.HarnessNode) { const paymentAmt = 100 // First establish a channel with a capacity equals to the overall @@ -245,7 +245,7 @@ func runAsyncPayments(ht *lntemp.HarnessTest, alice, bob *node.HarnessNode) { // Alice should send all money from her side to Bob. channelCapacity := btcutil.Amount(paymentAmt * 2000) chanPoint := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{Amt: channelCapacity}, + alice, bob, lntest.OpenChannelParams{Amt: channelCapacity}, ) info := ht.QueryChannelByChanPoint(alice, chanPoint) @@ -322,7 +322,7 @@ func runAsyncPayments(ht *lntemp.HarnessTest, alice, bob *node.HarnessNode) { // testBidirectionalAsyncPayments tests that nodes are able to send the // payments to each other in async manner without blocking. -func testBidirectionalAsyncPayments(ht *lntemp.HarnessTest) { +func testBidirectionalAsyncPayments(ht *lntest.HarnessTest) { const paymentAmt = 1000 // We use new nodes here as the benchmark test creates lots of data @@ -337,7 +337,7 @@ func testBidirectionalAsyncPayments(ht *lntemp.HarnessTest) { // amount of payments, between Alice and Bob, at the end of the test // Alice should send all money from her side to Bob. chanPoint := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{ + alice, bob, lntest.OpenChannelParams{ Amt: paymentAmt * 2000, PushAmt: paymentAmt * 1000, }, @@ -419,7 +419,7 @@ func testBidirectionalAsyncPayments(ht *lntemp.HarnessTest) { ht.CloseChannel(alice, chanPoint) } -func testInvoiceSubscriptions(ht *lntemp.HarnessTest) { +func testInvoiceSubscriptions(ht *lntest.HarnessTest) { const chanAmt = btcutil.Amount(500000) alice, bob := ht.Alice, ht.Bob @@ -432,7 +432,7 @@ func testInvoiceSubscriptions(ht *lntemp.HarnessTest) { // Open a channel with 500k satoshis between Alice and Bob with Alice // being the sole funder of the channel. chanPoint := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{Amt: chanAmt}, + alice, bob, lntest.OpenChannelParams{Amt: chanAmt}, ) // Next create a new invoice for Bob requesting 1k satoshis. @@ -549,7 +549,7 @@ func testInvoiceSubscriptions(ht *lntemp.HarnessTest) { // assertChannelState asserts the channel state by checking the values in // fields, LocalBalance, RemoteBalance and num of PendingHtlcs. -func assertChannelState(ht *lntemp.HarnessTest, hn *node.HarnessNode, +func assertChannelState(ht *lntest.HarnessTest, hn *node.HarnessNode, cp *lnrpc.ChannelPoint, localBalance, remoteBalance int64) { // Get the funding point. @@ -576,6 +576,6 @@ func assertChannelState(ht *lntemp.HarnessTest, hn *node.HarnessNode, } return nil - }, lntemp.DefaultTimeout) + }, lntest.DefaultTimeout) require.NoError(ht, err, "timeout while chekcing for balance") } diff --git a/itest/lnd_psbt_test.go b/itest/lnd_psbt_test.go index 0395a3ac7..d2673f86e 100644 --- a/itest/lnd_psbt_test.go +++ b/itest/lnd_psbt_test.go @@ -20,15 +20,15 @@ import ( "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/signrpc" "github.com/lightningnetwork/lnd/lnrpc/walletrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/stretchr/testify/require" ) // testPsbtChanFunding makes sure a channel can be opened between carol and dave // by using a Partially Signed Bitcoin Transaction that funds the channel // multisig funding output. -func testPsbtChanFunding(ht *lntemp.HarnessTest) { +func testPsbtChanFunding(ht *lntest.HarnessTest) { // First, we'll create two new nodes that we'll use to open channels // between for this test. Dave gets some coins that will be used to // fund the PSBT, just to make sure that Carol has an empty wallet. @@ -41,7 +41,7 @@ func testPsbtChanFunding(ht *lntemp.HarnessTest) { // runPsbtChanFunding makes sure a channel can be opened between carol and dave // by using a Partially Signed Bitcoin Transaction that funds the channel // multisig funding output. -func runPsbtChanFunding(ht *lntemp.HarnessTest, carol, dave *node.HarnessNode) { +func runPsbtChanFunding(ht *lntest.HarnessTest, carol, dave *node.HarnessNode) { const chanSize = funding.MaxBtcFundingAmount ht.FundCoins(btcutil.SatoshiPerBitcoin, dave) @@ -63,7 +63,7 @@ func runPsbtChanFunding(ht *lntemp.HarnessTest, carol, dave *node.HarnessNode) { // by specifying a PSBT shim. We use the NoPublish flag here to avoid // publishing the whole batch TX too early. chanUpdates, tempPsbt := ht.OpenChannelPsbt( - carol, dave, lntemp.OpenChannelParams{ + carol, dave, lntest.OpenChannelParams{ Amt: chanSize, FundingShim: &lnrpc.FundingShim{ Shim: &lnrpc.FundingShim_PsbtShim{ @@ -80,7 +80,7 @@ func runPsbtChanFunding(ht *lntemp.HarnessTest, carol, dave *node.HarnessNode) { // Alice. We will publish the batch TX once this channel funding is // complete. chanUpdates2, psbtBytes2 := ht.OpenChannelPsbt( - carol, alice, lntemp.OpenChannelParams{ + carol, alice, lntest.OpenChannelParams{ Amt: chanSize, FundingShim: &lnrpc.FundingShim{ Shim: &lnrpc.FundingShim_PsbtShim{ @@ -230,7 +230,7 @@ func runPsbtChanFunding(ht *lntemp.HarnessTest, carol, dave *node.HarnessNode) { // and dave by using a Partially Signed Bitcoin Transaction that funds the // channel multisig funding output and is fully funded by an external third // party. -func testPsbtChanFundingExternal(ht *lntemp.HarnessTest) { +func testPsbtChanFundingExternal(ht *lntest.HarnessTest) { const chanSize = funding.MaxBtcFundingAmount // First, we'll create two new nodes that we'll use to open channels @@ -257,7 +257,7 @@ func testPsbtChanFundingExternal(ht *lntemp.HarnessTest) { // by specifying a PSBT shim. We use the NoPublish flag here to avoid // publishing the whole batch TX too early. chanUpdates, tempPsbt := ht.OpenChannelPsbt( - carol, dave, lntemp.OpenChannelParams{ + carol, dave, lntest.OpenChannelParams{ Amt: chanSize, FundingShim: &lnrpc.FundingShim{ Shim: &lnrpc.FundingShim_PsbtShim{ @@ -274,7 +274,7 @@ func testPsbtChanFundingExternal(ht *lntemp.HarnessTest) { // Alice. We will publish the batch TX once this channel funding is // complete. chanUpdates2, psbtBytes2 := ht.OpenChannelPsbt( - carol, alice, lntemp.OpenChannelParams{ + carol, alice, lntest.OpenChannelParams{ Amt: chanSize, FundingShim: &lnrpc.FundingShim{ Shim: &lnrpc.FundingShim_PsbtShim{ @@ -412,10 +412,10 @@ func testPsbtChanFundingExternal(ht *lntemp.HarnessTest) { // the wallet of both nodes are empty and one of them uses PSBT and an external // wallet to fund the channel while creating reserve output in the same // transaction. -func testPsbtChanFundingSingleStep(ht *lntemp.HarnessTest) { +func testPsbtChanFundingSingleStep(ht *lntest.HarnessTest) { const chanSize = funding.MaxBtcFundingAmount - args := lntemp.NodeArgsForCommitType(lnrpc.CommitmentType_ANCHORS) + args := lntest.NodeArgsForCommitType(lnrpc.CommitmentType_ANCHORS) // First, we'll create two new nodes that we'll use to open channels // between for this test. But in this case both nodes have an empty @@ -453,7 +453,7 @@ func testPsbtChanFundingSingleStep(ht *lntemp.HarnessTest) { // Now that we have the pending channel ID, Carol will open the channel // by specifying a PSBT shim. chanUpdates, tempPsbt := ht.OpenChannelPsbt( - carol, dave, lntemp.OpenChannelParams{ + carol, dave, lntest.OpenChannelParams{ Amt: chanSize, FundingShim: &lnrpc.FundingShim{ Shim: &lnrpc.FundingShim_PsbtShim{ @@ -575,7 +575,7 @@ func testPsbtChanFundingSingleStep(ht *lntemp.HarnessTest) { } // testSignPsbt tests that the SignPsbt RPC works correctly. -func testSignPsbt(ht *lntemp.HarnessTest) { +func testSignPsbt(ht *lntest.HarnessTest) { runSignPsbtSegWitV0P2WKH(ht, ht.Alice) runSignPsbtSegWitV0NP2WKH(ht, ht.Alice) runSignPsbtSegWitV1KeySpendBip86(ht, ht.Alice) @@ -590,7 +590,7 @@ func testSignPsbt(ht *lntemp.HarnessTest) { // runSignPsbtSegWitV0P2WKH tests that the SignPsbt RPC works correctly for a // SegWit v0 p2wkh input. -func runSignPsbtSegWitV0P2WKH(ht *lntemp.HarnessTest, alice *node.HarnessNode) { +func runSignPsbtSegWitV0P2WKH(ht *lntest.HarnessTest, alice *node.HarnessNode) { // We test that we can sign a PSBT that spends funds from an input that // the wallet doesn't know about. To set up that test case, we first // derive an address manually that the wallet won't be watching on @@ -669,7 +669,7 @@ func runSignPsbtSegWitV0P2WKH(ht *lntemp.HarnessTest, alice *node.HarnessNode) { // runSignPsbtSegWitV0NP2WKH tests that the SignPsbt RPC works correctly for a // SegWit v0 np2wkh input. -func runSignPsbtSegWitV0NP2WKH(ht *lntemp.HarnessTest, +func runSignPsbtSegWitV0NP2WKH(ht *lntest.HarnessTest, alice *node.HarnessNode) { // We test that we can sign a PSBT that spends funds from an input that @@ -758,7 +758,7 @@ func runSignPsbtSegWitV0NP2WKH(ht *lntemp.HarnessTest, // runSignPsbtSegWitV1KeySpendBip86 tests that the SignPsbt RPC works correctly // for a SegWit v1 p2tr key spend BIP-0086 input. -func runSignPsbtSegWitV1KeySpendBip86(ht *lntemp.HarnessTest, +func runSignPsbtSegWitV1KeySpendBip86(ht *lntest.HarnessTest, alice *node.HarnessNode) { // Derive a key we can use for signing. @@ -802,7 +802,7 @@ func runSignPsbtSegWitV1KeySpendBip86(ht *lntemp.HarnessTest, // runSignPsbtSegWitV1KeySpendRootHash tests that the SignPsbt RPC works // correctly for a SegWit v1 p2tr key spend that also commits to a script tree // root hash. -func runSignPsbtSegWitV1KeySpendRootHash(ht *lntemp.HarnessTest, +func runSignPsbtSegWitV1KeySpendRootHash(ht *lntest.HarnessTest, alice *node.HarnessNode) { // Derive a key we can use for signing. @@ -849,7 +849,7 @@ func runSignPsbtSegWitV1KeySpendRootHash(ht *lntemp.HarnessTest, // runSignPsbtSegWitV1ScriptSpend tests that the SignPsbt RPC works correctly // for a SegWit v1 p2tr script spend. -func runSignPsbtSegWitV1ScriptSpend(ht *lntemp.HarnessTest, +func runSignPsbtSegWitV1ScriptSpend(ht *lntest.HarnessTest, alice *node.HarnessNode) { // Derive a key we can use for signing. @@ -910,7 +910,7 @@ func runSignPsbtSegWitV1ScriptSpend(ht *lntemp.HarnessTest, // runFundAndSignPsbt makes sure we can sign PSBTs that were funded by our // internal wallet. -func runFundAndSignPsbt(ht *lntemp.HarnessTest, alice *node.HarnessNode) { +func runFundAndSignPsbt(ht *lntest.HarnessTest, alice *node.HarnessNode) { alice.AddToLogf("================ runFundAndSignPsbt ===============") // We'll be using a "main" address where we send the funds to and from @@ -964,7 +964,7 @@ func runFundAndSignPsbt(ht *lntemp.HarnessTest, alice *node.HarnessNode) { // assertPsbtSpend creates an output with the given pkScript on chain and then // attempts to create a sweep transaction that is signed using the SignPsbt RPC // that spends that output again. -func assertPsbtSpend(ht *lntemp.HarnessTest, alice *node.HarnessNode, +func assertPsbtSpend(ht *lntest.HarnessTest, alice *node.HarnessNode, pkScript []byte, decorateUnsigned func(*psbt.Packet), verifySigned func(*psbt.Packet)) { @@ -1073,7 +1073,7 @@ func assertPsbtSpend(ht *lntemp.HarnessTest, alice *node.HarnessNode, // assertPsbtFundSignSpend funds a PSBT from the internal wallet and then // attempts to sign it by using the SignPsbt or FinalizePsbt method. -func assertPsbtFundSignSpend(ht *lntemp.HarnessTest, alice *node.HarnessNode, +func assertPsbtFundSignSpend(ht *lntest.HarnessTest, alice *node.HarnessNode, fundOutputs map[string]uint64, changeType walletrpc.ChangeAddressType, useFinalize bool) { @@ -1148,7 +1148,7 @@ func assertPsbtFundSignSpend(ht *lntemp.HarnessTest, alice *node.HarnessNode, // assertChangeScriptType checks if the given script has the right type given // the change address type we used in FundPsbt. By default, the script should // be a P2WPKH one. -func assertChangeScriptType(ht *lntemp.HarnessTest, script []byte, +func assertChangeScriptType(ht *lntest.HarnessTest, script []byte, fundChangeType walletrpc.ChangeAddressType) { switch fundChangeType { @@ -1162,7 +1162,7 @@ func assertChangeScriptType(ht *lntemp.HarnessTest, script []byte, // deriveInternalKey derives a signing key and returns its descriptor, full // derivation path and parsed public key. -func deriveInternalKey(ht *lntemp.HarnessTest, +func deriveInternalKey(ht *lntest.HarnessTest, alice *node.HarnessNode) (*signrpc.KeyDescriptor, *btcec.PublicKey, []uint32) { @@ -1221,7 +1221,7 @@ func receiveChanUpdate(ctx context.Context, // sendAllCoinsToAddrType sweeps all coins from the wallet and sends them to a // new address of the given type. -func sendAllCoinsToAddrType(ht *lntemp.HarnessTest, +func sendAllCoinsToAddrType(ht *lntest.HarnessTest, hn *node.HarnessNode, addrType lnrpc.AddressType) { resp := hn.RPC.NewAddress(&lnrpc.NewAddressRequest{ diff --git a/itest/lnd_recovery_test.go b/itest/lnd_recovery_test.go index 4ba521912..ef251f042 100644 --- a/itest/lnd_recovery_test.go +++ b/itest/lnd_recovery_test.go @@ -15,8 +15,8 @@ import ( "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/signrpc" "github.com/lightningnetwork/lnd/lnrpc/walletrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/lntest/wait" "github.com/lightningnetwork/lnd/lnwallet/chainfee" "github.com/stretchr/testify/require" @@ -24,7 +24,7 @@ import ( // testGetRecoveryInfo checks whether lnd gives the right information about // the wallet recovery process. -func testGetRecoveryInfo(ht *lntemp.HarnessTest) { +func testGetRecoveryInfo(ht *lntest.HarnessTest) { // First, create a new node with strong passphrase and grab the mnemonic // used for key derivation. This will bring up Carol with an empty // wallet, and such that she is synced up. @@ -94,7 +94,7 @@ func testGetRecoveryInfo(ht *lntemp.HarnessTest) { // when providing a valid aezeed that owns outputs on the chain. This test // performs multiple restorations using the same seed and various recovery // windows to ensure we detect funds properly. -func testOnchainFundRecovery(ht *lntemp.HarnessTest) { +func testOnchainFundRecovery(ht *lntest.HarnessTest) { // First, create a new node with strong passphrase and grab the mnemonic // used for key derivation. This will bring up Carol with an empty // wallet, and such that she is synced up. @@ -321,7 +321,7 @@ func testOnchainFundRecovery(ht *lntemp.HarnessTest) { // The fix in the wallet is simple: In step 6, don't detect addresses from // internal scopes while re-scanning to be in line with the logic in other areas // of the wallet code. -func testRescanAddressDetection(ht *lntemp.HarnessTest) { +func testRescanAddressDetection(ht *lntest.HarnessTest) { // We start off by creating a new node with the wallet re-scan flag // enabled. This won't have any effect on the first startup but will // come into effect after we re-start the node. diff --git a/itest/lnd_remote_signer_test.go b/itest/lnd_remote_signer_test.go index 8b7a2b6a6..45f806cfd 100644 --- a/itest/lnd_remote_signer_test.go +++ b/itest/lnd_remote_signer_test.go @@ -11,8 +11,8 @@ import ( "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/signrpc" "github.com/lightningnetwork/lnd/lnrpc/walletrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/stretchr/testify/require" ) @@ -55,24 +55,24 @@ var ( // testRemoteSigner tests that a watch-only wallet can use a remote signing // wallet to perform any signing or ECDH operations. -func testRemoteSigner(ht *lntemp.HarnessTest) { +func testRemoteSigner(ht *lntest.HarnessTest) { type testCase struct { name string randomSeed bool sendCoins bool - fn func(tt *lntemp.HarnessTest, + fn func(tt *lntest.HarnessTest, wo, carol *node.HarnessNode) } subTests := []testCase{{ name: "random seed", randomSeed: true, - fn: func(tt *lntemp.HarnessTest, wo, carol *node.HarnessNode) { + fn: func(tt *lntest.HarnessTest, wo, carol *node.HarnessNode) { // Nothing more to test here. }, }, { name: "account import", - fn: func(tt *lntemp.HarnessTest, wo, carol *node.HarnessNode) { + fn: func(tt *lntest.HarnessTest, wo, carol *node.HarnessNode) { runWalletImportAccountScenario( tt, walletrpc.AddressType_WITNESS_PUBKEY_HASH, carol, wo, @@ -81,36 +81,36 @@ func testRemoteSigner(ht *lntemp.HarnessTest) { }, { name: "basic channel open close", sendCoins: true, - fn: func(tt *lntemp.HarnessTest, wo, carol *node.HarnessNode) { + fn: func(tt *lntest.HarnessTest, wo, carol *node.HarnessNode) { runBasicChannelCreationAndUpdates(tt, wo, carol) }, }, { name: "channel funding input types", sendCoins: false, - fn: func(tt *lntemp.HarnessTest, wo, carol *node.HarnessNode) { + fn: func(tt *lntest.HarnessTest, wo, carol *node.HarnessNode) { runChannelFundingInputTypes(tt, carol, wo) }, }, { name: "async payments", sendCoins: true, - fn: func(tt *lntemp.HarnessTest, wo, carol *node.HarnessNode) { + fn: func(tt *lntest.HarnessTest, wo, carol *node.HarnessNode) { runAsyncPayments(tt, wo, carol) }, }, { name: "shared key", - fn: func(tt *lntemp.HarnessTest, wo, carol *node.HarnessNode) { + fn: func(tt *lntest.HarnessTest, wo, carol *node.HarnessNode) { runDeriveSharedKey(tt, wo) }, }, { name: "cpfp", sendCoins: true, - fn: func(tt *lntemp.HarnessTest, wo, carol *node.HarnessNode) { + fn: func(tt *lntest.HarnessTest, wo, carol *node.HarnessNode) { runCPFP(tt, wo, carol) }, }, { name: "psbt", randomSeed: true, - fn: func(tt *lntemp.HarnessTest, wo, carol *node.HarnessNode) { + fn: func(tt *lntest.HarnessTest, wo, carol *node.HarnessNode) { runPsbtChanFunding(tt, carol, wo) runSignPsbtSegWitV0P2WKH(tt, wo) runSignPsbtSegWitV1KeySpendBip86(tt, wo) @@ -125,20 +125,20 @@ func testRemoteSigner(ht *lntemp.HarnessTest) { }, { name: "sign output raw", sendCoins: true, - fn: func(tt *lntemp.HarnessTest, wo, carol *node.HarnessNode) { + fn: func(tt *lntest.HarnessTest, wo, carol *node.HarnessNode) { runSignOutputRaw(tt, wo) }, }, { name: "sign verify msg", sendCoins: true, - fn: func(tt *lntemp.HarnessTest, wo, carol *node.HarnessNode) { + fn: func(tt *lntest.HarnessTest, wo, carol *node.HarnessNode) { runSignVerifyMessage(tt, wo) }, }, { name: "taproot", sendCoins: true, randomSeed: true, - fn: func(tt *lntemp.HarnessTest, wo, carol *node.HarnessNode) { + fn: func(tt *lntest.HarnessTest, wo, carol *node.HarnessNode) { testTaprootSendCoinsKeySpendBip86(tt, wo) testTaprootComputeInputScriptKeySpendBip86(tt, wo) testTaprootSignOutputRawScriptSpend(tt, wo) @@ -162,7 +162,7 @@ func testRemoteSigner(ht *lntemp.HarnessTest) { }, }} - prepareTest := func(st *lntemp.HarnessTest, + prepareTest := func(st *lntest.HarnessTest, subTest testCase) (*node.HarnessNode, *node.HarnessNode, *node.HarnessNode) { diff --git a/itest/lnd_res_handoff_test.go b/itest/lnd_res_handoff_test.go index a18d2fce0..e6c10b48f 100644 --- a/itest/lnd_res_handoff_test.go +++ b/itest/lnd_res_handoff_test.go @@ -5,13 +5,13 @@ import ( "github.com/btcsuite/btcd/btcutil" "github.com/lightningnetwork/lnd/lnrpc" - "github.com/lightningnetwork/lnd/lntemp" + "github.com/lightningnetwork/lnd/lntest" "github.com/stretchr/testify/require" ) // testResHandoff tests that the contractcourt is able to properly hand-off // resolution messages to the switch. -func testResHandoff(ht *lntemp.HarnessTest) { +func testResHandoff(ht *lntest.HarnessTest) { const ( chanAmt = btcutil.Amount(1000000) paymentAmt = 50000 @@ -22,7 +22,7 @@ func testResHandoff(ht *lntemp.HarnessTest) { // First we'll create a channel between Alice and Bob. ht.EnsureConnected(alice, bob) - params := lntemp.OpenChannelParams{Amt: chanAmt} + params := lntest.OpenChannelParams{Amt: chanAmt} chanPointAlice := ht.OpenChannel(alice, bob, params) // Create a new node Carol that will be in hodl mode. This is used to diff --git a/itest/lnd_rest_api_test.go b/itest/lnd_rest_api_test.go index 43aff6110..3a9674a35 100644 --- a/itest/lnd_rest_api_test.go +++ b/itest/lnd_rest_api_test.go @@ -23,8 +23,8 @@ import ( "github.com/lightningnetwork/lnd/lnrpc/routerrpc" "github.com/lightningnetwork/lnd/lnrpc/verrpc" "github.com/lightningnetwork/lnd/lnrpc/walletrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/stretchr/testify/require" ) @@ -56,7 +56,7 @@ var ( // testRestAPI tests that the most important features of the REST API work // correctly. -func testRestAPI(ht *lntemp.HarnessTest) { +func testRestAPI(ht *lntest.HarnessTest) { testCases := []struct { name string run func(*testing.T, *node.HarnessNode, *node.HarnessNode) @@ -201,7 +201,7 @@ func testRestAPI(ht *lntemp.HarnessTest) { }} wsTestCases := []struct { name string - run func(ht *lntemp.HarnessTest) + run func(ht *lntest.HarnessTest) }{{ name: "websocket subscription", run: wsTestCaseSubscription, @@ -243,7 +243,7 @@ func testRestAPI(ht *lntemp.HarnessTest) { } } -func wsTestCaseSubscription(ht *lntemp.HarnessTest) { +func wsTestCaseSubscription(ht *lntest.HarnessTest) { // Find out the current best block so we can subscribe to the next one. hash, height := ht.Miner.GetBestBlock() @@ -317,7 +317,7 @@ func wsTestCaseSubscription(ht *lntemp.HarnessTest) { } } -func wsTestCaseSubscriptionMacaroon(ht *lntemp.HarnessTest) { +func wsTestCaseSubscriptionMacaroon(ht *lntest.HarnessTest) { // Find out the current best block so we can subscribe to the next one. hash, height := ht.Miner.GetBestBlock() @@ -407,7 +407,7 @@ func wsTestCaseSubscriptionMacaroon(ht *lntemp.HarnessTest) { } } -func wsTestCaseBiDirectionalSubscription(ht *lntemp.HarnessTest) { +func wsTestCaseBiDirectionalSubscription(ht *lntest.HarnessTest) { initialRequest := &lnrpc.ChannelAcceptResponse{} url := "/v1/channels/acceptor" @@ -530,7 +530,7 @@ func wsTestCaseBiDirectionalSubscription(ht *lntemp.HarnessTest) { const numChannels = 3 for i := 0; i < numChannels; i++ { chanPoint := ht.OpenChannel( - bob, alice, lntemp.OpenChannelParams{Amt: 500000}, + bob, alice, lntest.OpenChannelParams{Amt: 500000}, ) defer ht.CloseChannel(bob, chanPoint) @@ -545,7 +545,7 @@ func wsTestCaseBiDirectionalSubscription(ht *lntemp.HarnessTest) { } } -func wsTestPingPongTimeout(ht *lntemp.HarnessTest) { +func wsTestPingPongTimeout(ht *lntest.HarnessTest) { initialRequest := &lnrpc.InvoiceSubscription{ AddIndex: 1, SettleIndex: 1, } diff --git a/itest/lnd_revocation_test.go b/itest/lnd_revocation_test.go index 0184d634b..4ec04a11c 100644 --- a/itest/lnd_revocation_test.go +++ b/itest/lnd_revocation_test.go @@ -12,7 +12,7 @@ import ( "github.com/lightningnetwork/lnd/funding" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/wtclientrpc" - "github.com/lightningnetwork/lnd/lntemp" + "github.com/lightningnetwork/lnd/lntest" "github.com/lightningnetwork/lnd/lntest/wait" "github.com/stretchr/testify/require" ) @@ -20,7 +20,7 @@ import ( // testRevokedCloseRetribution tests that Carol is able carry out // retribution in the event that she fails immediately after detecting Bob's // breach txn in the mempool. -func testRevokedCloseRetribution(ht *lntemp.HarnessTest) { +func testRevokedCloseRetribution(ht *lntest.HarnessTest) { const ( chanAmt = funding.MaxBtcFundingAmount paymentAmt = 10000 @@ -50,7 +50,7 @@ func testRevokedCloseRetribution(ht *lntemp.HarnessTest) { // closure by Bob, we'll first open up a channel between them with a // 0.5 BTC value. chanPoint := ht.OpenChannel( - carol, bob, lntemp.OpenChannelParams{Amt: chanAmt}, + carol, bob, lntest.OpenChannelParams{Amt: chanAmt}, ) // With the channel open, we'll create a few invoices for Bob that @@ -165,7 +165,7 @@ func testRevokedCloseRetribution(ht *lntemp.HarnessTest) { // testRevokedCloseRetributionZeroValueRemoteOutput tests that Dave is able // carry out retribution in the event that he fails in state where the remote // commitment output has zero-value. -func testRevokedCloseRetributionZeroValueRemoteOutput(ht *lntemp.HarnessTest) { +func testRevokedCloseRetributionZeroValueRemoteOutput(ht *lntest.HarnessTest) { const ( chanAmt = funding.MaxBtcFundingAmount paymentAmt = 10000 @@ -198,7 +198,7 @@ func testRevokedCloseRetributionZeroValueRemoteOutput(ht *lntemp.HarnessTest) { // closure by Carol, we'll first open up a channel between them with a // 0.5 BTC value. chanPoint := ht.OpenChannel( - dave, carol, lntemp.OpenChannelParams{Amt: chanAmt}, + dave, carol, lntest.OpenChannelParams{Amt: chanAmt}, ) // With the channel open, we'll create a few invoices for Carol that @@ -297,7 +297,7 @@ func testRevokedCloseRetributionZeroValueRemoteOutput(ht *lntemp.HarnessTest) { // testRevokedCloseRetributionRemoteHodl tests that Dave properly responds to a // channel breach made by the remote party, specifically in the case that the // remote party breaches before settling extended HTLCs. -func testRevokedCloseRetributionRemoteHodl(ht *lntemp.HarnessTest) { +func testRevokedCloseRetributionRemoteHodl(ht *lntest.HarnessTest) { const ( chanAmt = funding.MaxBtcFundingAmount pushAmt = 200000 @@ -332,7 +332,7 @@ func testRevokedCloseRetributionRemoteHodl(ht *lntemp.HarnessTest) { // by Carol, we'll first open up a channel between them with a // funding.MaxBtcFundingAmount (2^24) satoshis value. chanPoint := ht.OpenChannel( - dave, carol, lntemp.OpenChannelParams{ + dave, carol, lntest.OpenChannelParams{ Amt: chanAmt, PushAmt: pushAmt, }, @@ -577,7 +577,7 @@ func testRevokedCloseRetributionRemoteHodl(ht *lntemp.HarnessTest) { // trigger a breach. Carol is kept offline throughout the process and the test // asserts that Willy responds by broadcasting the justice transaction on // Carol's behalf sweeping her funds without a reward. -func testRevokedCloseRetributionAltruistWatchtower(ht *lntemp.HarnessTest) { +func testRevokedCloseRetributionAltruistWatchtower(ht *lntest.HarnessTest) { testCases := []struct { name string anchors bool @@ -591,7 +591,7 @@ func testRevokedCloseRetributionAltruistWatchtower(ht *lntemp.HarnessTest) { for _, tc := range testCases { tc := tc - testFunc := func(ht *lntemp.HarnessTest) { + testFunc := func(ht *lntest.HarnessTest) { testRevokedCloseRetributionAltruistWatchtowerCase( ht, tc.anchors, ) @@ -600,7 +600,7 @@ func testRevokedCloseRetributionAltruistWatchtower(ht *lntemp.HarnessTest) { success := ht.Run(tc.name, func(tt *testing.T) { st := ht.Subtest(tt) - st.RunTestCase(&lntemp.TestCase{ + st.RunTestCase(&lntest.TestCase{ Name: tc.name, TestFunc: testFunc, }) @@ -618,7 +618,7 @@ func testRevokedCloseRetributionAltruistWatchtower(ht *lntemp.HarnessTest) { } } -func testRevokedCloseRetributionAltruistWatchtowerCase(ht *lntemp.HarnessTest, +func testRevokedCloseRetributionAltruistWatchtowerCase(ht *lntest.HarnessTest, anchors bool) { const ( @@ -695,7 +695,7 @@ func testRevokedCloseRetributionAltruistWatchtowerCase(ht *lntemp.HarnessTest, // In order to test Dave's response to an uncooperative channel // closure by Carol, we'll first open up a channel between them with a // 0.5 BTC value. - params := lntemp.OpenChannelParams{ + params := lntest.OpenChannelParams{ Amt: 3 * (chanAmt / 4), PushAmt: chanAmt / 4, } diff --git a/itest/lnd_routing_test.go b/itest/lnd_routing_test.go index 7dd9ef299..4d6746279 100644 --- a/itest/lnd_routing_test.go +++ b/itest/lnd_routing_test.go @@ -10,8 +10,8 @@ import ( "github.com/lightningnetwork/lnd/chainreg" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/lntest/wait" "github.com/lightningnetwork/lnd/lnwire" "github.com/stretchr/testify/require" @@ -65,7 +65,7 @@ var singleHopSendToRouteCases = []singleHopSendToRouteCase{ // by feeding the route back into the various SendToRoute RPC methods. Here we // test all three SendToRoute endpoints, forcing each to perform both a regular // payment and an MPP payment. -func testSingleHopSendToRoute(ht *lntemp.HarnessTest) { +func testSingleHopSendToRoute(ht *lntest.HarnessTest) { for _, test := range singleHopSendToRouteCases { test := test @@ -76,7 +76,7 @@ func testSingleHopSendToRoute(ht *lntemp.HarnessTest) { } } -func testSingleHopSendToRouteCase(ht *lntemp.HarnessTest, +func testSingleHopSendToRouteCase(ht *lntest.HarnessTest, test singleHopSendToRouteCase) { const chanAmt = btcutil.Amount(100000) @@ -97,7 +97,7 @@ func testSingleHopSendToRouteCase(ht *lntemp.HarnessTest, // Open a channel with 100k satoshis between Carol and Dave with Carol // being the sole funder of the channel. chanPointCarol := ht.OpenChannel( - carol, dave, lntemp.OpenChannelParams{Amt: chanAmt}, + carol, dave, lntest.OpenChannelParams{Amt: chanAmt}, ) defer ht.CloseChannel(carol, chanPointCarol) @@ -289,7 +289,7 @@ func testSingleHopSendToRouteCase(ht *lntemp.HarnessTest, // // We'll query the daemon for routes from Alice to Carol and then // send payments through the routes. -func testMultiHopSendToRoute(ht *lntemp.HarnessTest) { +func testMultiHopSendToRoute(ht *lntest.HarnessTest) { ht.Run("with cache", func(tt *testing.T) { st := ht.Subtest(tt) runMultiHopSendToRoute(st, true) @@ -309,7 +309,7 @@ func testMultiHopSendToRoute(ht *lntemp.HarnessTest) { // // We'll query the daemon for routes from Alice to Carol and then // send payments through the routes. -func runMultiHopSendToRoute(ht *lntemp.HarnessTest, useGraphCache bool) { +func runMultiHopSendToRoute(ht *lntest.HarnessTest, useGraphCache bool) { var opts []string if !useGraphCache { opts = append(opts, "--db.no-graph-cache") @@ -325,7 +325,7 @@ func runMultiHopSendToRoute(ht *lntemp.HarnessTest, useGraphCache bool) { // Open a channel with 100k satoshis between Alice and Bob with Alice // being the sole funder of the channel. chanPointAlice := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{Amt: chanAmt}, + alice, bob, lntest.OpenChannelParams{Amt: chanAmt}, ) defer ht.CloseChannel(alice, chanPointAlice) @@ -337,7 +337,7 @@ func runMultiHopSendToRoute(ht *lntemp.HarnessTest, useGraphCache bool) { ht.ConnectNodes(carol, bob) chanPointBob := ht.OpenChannel( - bob, carol, lntemp.OpenChannelParams{Amt: chanAmt}, + bob, carol, lntest.OpenChannelParams{Amt: chanAmt}, ) defer ht.CloseChannel(carol, chanPointBob) @@ -407,14 +407,14 @@ func runMultiHopSendToRoute(ht *lntemp.HarnessTest, useGraphCache bool) { // testSendToRouteErrorPropagation tests propagation of errors that occur // while processing a multi-hop payment through an unknown route. -func testSendToRouteErrorPropagation(ht *lntemp.HarnessTest) { +func testSendToRouteErrorPropagation(ht *lntest.HarnessTest) { const chanAmt = btcutil.Amount(100000) // Open a channel with 100k satoshis between Alice and Bob with Alice // being the sole funder of the channel. alice, bob := ht.Alice, ht.Bob chanPointAlice := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{Amt: chanAmt}, + alice, bob, lntest.OpenChannelParams{Amt: chanAmt}, ) // Create a new nodes (Carol and Charlie), load her with some funds, @@ -432,7 +432,7 @@ func testSendToRouteErrorPropagation(ht *lntemp.HarnessTest) { ht.FundCoins(btcutil.SatoshiPerBitcoin, charlie) ht.ConnectNodes(carol, charlie) - ht.OpenChannel(carol, charlie, lntemp.OpenChannelParams{Amt: chanAmt}) + ht.OpenChannel(carol, charlie, lntest.OpenChannelParams{Amt: chanAmt}) // Query routes from Carol to Charlie which will be an invalid route // for Alice -> Bob. @@ -476,7 +476,7 @@ func testSendToRouteErrorPropagation(ht *lntemp.HarnessTest) { // testPrivateChannels tests that a private channel can be used for // routing by the two endpoints of the channel, but is not known by // the rest of the nodes in the graph. -func testPrivateChannels(ht *lntemp.HarnessTest) { +func testPrivateChannels(ht *lntest.HarnessTest) { const chanAmt = btcutil.Amount(100000) // We create the following topology: @@ -493,7 +493,7 @@ func testPrivateChannels(ht *lntemp.HarnessTest) { // Open a channel with 200k satoshis between Alice and Bob. alice, bob := ht.Alice, ht.Bob chanPointAlice := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{Amt: chanAmt * 2}, + alice, bob, lntest.OpenChannelParams{Amt: chanAmt * 2}, ) // Create Dave, and a channel to Alice of 100k. @@ -502,7 +502,7 @@ func testPrivateChannels(ht *lntemp.HarnessTest) { ht.FundCoins(btcutil.SatoshiPerBitcoin, dave) chanPointDave := ht.OpenChannel( - dave, alice, lntemp.OpenChannelParams{Amt: chanAmt}, + dave, alice, lntest.OpenChannelParams{Amt: chanAmt}, ) // Next, we'll create Carol and establish a channel from her to @@ -512,14 +512,14 @@ func testPrivateChannels(ht *lntemp.HarnessTest) { ht.FundCoins(btcutil.SatoshiPerBitcoin, carol) chanPointCarol := ht.OpenChannel( - carol, dave, lntemp.OpenChannelParams{Amt: chanAmt}, + carol, dave, lntest.OpenChannelParams{Amt: chanAmt}, ) // Now create a _private_ channel directly between Carol and // Alice of 100k. ht.ConnectNodes(carol, alice) chanPointPrivate := ht.OpenChannel( - carol, alice, lntemp.OpenChannelParams{ + carol, alice, lntest.OpenChannelParams{ Amt: chanAmt, Private: true, }, @@ -602,7 +602,7 @@ func testPrivateChannels(ht *lntemp.HarnessTest) { // testInvoiceRoutingHints tests that the routing hints for an invoice are // created properly. -func testInvoiceRoutingHints(ht *lntemp.HarnessTest) { +func testInvoiceRoutingHints(ht *lntest.HarnessTest) { const chanAmt = btcutil.Amount(100000) // Throughout this test, we'll be opening a channel between Alice and @@ -615,7 +615,7 @@ func testInvoiceRoutingHints(ht *lntemp.HarnessTest) { // invoice's payment. alice, bob := ht.Alice, ht.Bob chanPointBob := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{ + alice, bob, lntest.OpenChannelParams{ Amt: chanAmt, PushAmt: chanAmt / 2, Private: true, @@ -629,7 +629,7 @@ func testInvoiceRoutingHints(ht *lntemp.HarnessTest) { ht.ConnectNodes(alice, carol) chanPointCarol := ht.OpenChannel( - alice, carol, lntemp.OpenChannelParams{ + alice, carol, lntest.OpenChannelParams{ Amt: chanAmt, PushAmt: chanAmt / 2, }, @@ -642,7 +642,7 @@ func testInvoiceRoutingHints(ht *lntemp.HarnessTest) { // that wish to stay unadvertised. ht.ConnectNodes(bob, carol) chanPointBobCarol := ht.OpenChannel( - bob, carol, lntemp.OpenChannelParams{ + bob, carol, lntest.OpenChannelParams{ Amt: chanAmt, PushAmt: chanAmt / 2, }, @@ -656,7 +656,7 @@ func testInvoiceRoutingHints(ht *lntemp.HarnessTest) { ht.ConnectNodes(alice, dave) chanPointDave := ht.OpenChannel( - alice, dave, lntemp.OpenChannelParams{ + alice, dave, lntest.OpenChannelParams{ Amt: chanAmt, Private: true, }, @@ -669,7 +669,7 @@ func testInvoiceRoutingHints(ht *lntemp.HarnessTest) { eve := ht.NewNode("Eve", nil) ht.ConnectNodes(alice, eve) chanPointEve := ht.OpenChannel( - alice, eve, lntemp.OpenChannelParams{ + alice, eve, lntest.OpenChannelParams{ Amt: chanAmt, PushAmt: chanAmt / 2, Private: true, @@ -744,7 +744,7 @@ func testInvoiceRoutingHints(ht *lntemp.HarnessTest) { // testMultiHopOverPrivateChannels tests that private channels can be used as // intermediate hops in a route for payments. -func testMultiHopOverPrivateChannels(ht *lntemp.HarnessTest) { +func testMultiHopOverPrivateChannels(ht *lntest.HarnessTest) { // We'll test that multi-hop payments over private channels work as // intended. To do so, we'll create the following topology: // private public private @@ -755,7 +755,7 @@ func testMultiHopOverPrivateChannels(ht *lntemp.HarnessTest) { // being the funder. alice, bob := ht.Alice, ht.Bob chanPointAlice := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{ + alice, bob, lntest.OpenChannelParams{ Amt: chanAmt, Private: true, }, @@ -766,7 +766,7 @@ func testMultiHopOverPrivateChannels(ht *lntemp.HarnessTest) { carol := ht.NewNode("Carol", nil) ht.ConnectNodes(bob, carol) chanPointBob := ht.OpenChannel( - bob, carol, lntemp.OpenChannelParams{ + bob, carol, lntest.OpenChannelParams{ Amt: chanAmt, }, ) @@ -781,7 +781,7 @@ func testMultiHopOverPrivateChannels(ht *lntemp.HarnessTest) { ht.FundCoins(btcutil.SatoshiPerBitcoin, carol) chanPointCarol := ht.OpenChannel( - carol, dave, lntemp.OpenChannelParams{ + carol, dave, lntest.OpenChannelParams{ Amt: chanAmt, Private: true, }, @@ -851,7 +851,7 @@ func testMultiHopOverPrivateChannels(ht *lntemp.HarnessTest) { // Alice --> Bob --> Carol --> Dave // // and query the daemon for routes from Alice to Dave. -func testQueryRoutes(ht *lntemp.HarnessTest) { +func testQueryRoutes(ht *lntest.HarnessTest) { const chanAmt = btcutil.Amount(100000) // Grab Alice and Bob from the standby nodes. @@ -869,8 +869,8 @@ func testQueryRoutes(ht *lntemp.HarnessTest) { // We now proceed to open channels: // Alice=>Bob, Bob=>Carol and Carol=>Dave. - p := lntemp.OpenChannelParams{Amt: chanAmt} - reqs := []*lntemp.OpenChannelRequest{ + p := lntest.OpenChannelParams{Amt: chanAmt} + reqs := []*lntest.OpenChannelRequest{ {Local: alice, Remote: bob, Param: p}, {Local: bob, Remote: carol, Param: p}, {Local: carol, Remote: dave, Param: p}, @@ -1086,7 +1086,7 @@ func testMissionControlCfg(t *testing.T, hn *node.HarnessNode) { // testMissionControlImport tests import of mission control results from an // external source. -func testMissionControlImport(ht *lntemp.HarnessTest, hn *node.HarnessNode, +func testMissionControlImport(ht *lntest.HarnessTest, hn *node.HarnessNode, fromNode, toNode []byte) { // Reset mission control so that our query will return the default @@ -1138,7 +1138,7 @@ func testMissionControlImport(ht *lntemp.HarnessTest, hn *node.HarnessNode, // testRouteFeeCutoff tests that we are able to prevent querying routes and // sending payments that incur a fee higher than the fee limit. -func testRouteFeeCutoff(ht *lntemp.HarnessTest) { +func testRouteFeeCutoff(ht *lntest.HarnessTest) { // For this test, we'll create the following topology: // // --- Bob --- @@ -1155,7 +1155,7 @@ func testRouteFeeCutoff(ht *lntemp.HarnessTest) { // Open a channel between Alice and Bob. alice, bob := ht.Alice, ht.Bob chanPointAliceBob := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{Amt: chanAmt}, + alice, bob, lntest.OpenChannelParams{Amt: chanAmt}, ) // Create Carol's node and open a channel between her and Alice with @@ -1165,7 +1165,7 @@ func testRouteFeeCutoff(ht *lntemp.HarnessTest) { ht.FundCoins(btcutil.SatoshiPerBitcoin, carol) chanPointAliceCarol := ht.OpenChannel( - alice, carol, lntemp.OpenChannelParams{Amt: chanAmt}, + alice, carol, lntest.OpenChannelParams{Amt: chanAmt}, ) // Create Dave's node and open a channel between him and Bob with Bob @@ -1173,13 +1173,13 @@ func testRouteFeeCutoff(ht *lntemp.HarnessTest) { dave := ht.NewNode("Dave", nil) ht.ConnectNodes(dave, bob) chanPointBobDave := ht.OpenChannel( - bob, dave, lntemp.OpenChannelParams{Amt: chanAmt}, + bob, dave, lntest.OpenChannelParams{Amt: chanAmt}, ) // Open a channel between Carol and Dave. ht.ConnectNodes(carol, dave) chanPointCarolDave := ht.OpenChannel( - carol, dave, lntemp.OpenChannelParams{Amt: chanAmt}, + carol, dave, lntest.OpenChannelParams{Amt: chanAmt}, ) // Now that all the channels were set up, we'll wait for all the nodes @@ -1203,7 +1203,7 @@ func testRouteFeeCutoff(ht *lntemp.HarnessTest) { baseFee := int64(10000) feeRate := int64(5) timeLockDelta := uint32(chainreg.DefaultBitcoinTimeLockDelta) - maxHtlc := lntemp.CalculateMaxHtlc(chanAmt) + maxHtlc := lntest.CalculateMaxHtlc(chanAmt) expectedPolicy := &lnrpc.RoutingPolicy{ FeeBaseMsat: baseFee, diff --git a/itest/lnd_rpc_middleware_interceptor_test.go b/itest/lnd_rpc_middleware_interceptor_test.go index f9a793db4..7c99f6f20 100644 --- a/itest/lnd_rpc_middleware_interceptor_test.go +++ b/itest/lnd_rpc_middleware_interceptor_test.go @@ -8,8 +8,8 @@ import ( "github.com/btcsuite/btcd/btcutil" "github.com/lightningnetwork/lnd/lnrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/macaroons" "github.com/lightningnetwork/lnd/zpay32" "github.com/stretchr/testify/require" @@ -19,7 +19,7 @@ import ( // testRPCMiddlewareInterceptor tests that the RPC middleware interceptor can // be used correctly and in a safe way. -func testRPCMiddlewareInterceptor(ht *lntemp.HarnessTest) { +func testRPCMiddlewareInterceptor(ht *lntest.HarnessTest) { // Let's first enable the middleware interceptor. // // NOTE: we cannot use standby nodes here as the test messes with @@ -32,7 +32,7 @@ func testRPCMiddlewareInterceptor(ht *lntemp.HarnessTest) { // data to inspect when doing RPC calls to Alice later. ht.EnsureConnected(alice, bob) ht.FundCoins(btcutil.SatoshiPerBitcoin, alice) - ht.OpenChannel(alice, bob, lntemp.OpenChannelParams{Amt: 1_234_567}) + ht.OpenChannel(alice, bob, lntest.OpenChannelParams{Amt: 1_234_567}) // Load or bake the macaroons that the simulated users will use to // access the RPC. @@ -545,7 +545,7 @@ func middlewareRequestManipulationTest(t *testing.T, node *node.HarnessNode, // middlewareMandatoryTest tests that all RPC requests are blocked if there is // a mandatory middleware declared that's currently not registered. -func middlewareMandatoryTest(ht *lntemp.HarnessTest, node *node.HarnessNode) { +func middlewareMandatoryTest(ht *lntest.HarnessTest, node *node.HarnessNode) { // Let's declare our itest interceptor as mandatory but don't register // it just yet. That should cause all RPC requests to fail, except for // the registration itself. diff --git a/itest/lnd_send_multi_path_payment_test.go b/itest/lnd_send_multi_path_payment_test.go index 0e5cfc24a..143cf496d 100644 --- a/itest/lnd_send_multi_path_payment_test.go +++ b/itest/lnd_send_multi_path_payment_test.go @@ -6,13 +6,13 @@ import ( "github.com/btcsuite/btcd/btcutil" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" - "github.com/lightningnetwork/lnd/lntemp" + "github.com/lightningnetwork/lnd/lntest" "github.com/stretchr/testify/require" ) // testSendMultiPathPayment tests that we are able to successfully route a // payment using multiple shards across different paths. -func testSendMultiPathPayment(ht *lntemp.HarnessTest) { +func testSendMultiPathPayment(ht *lntest.HarnessTest) { mts := newMppTestScenario(ht) const paymentAmt = btcutil.Amount(300000) diff --git a/itest/lnd_signer_test.go b/itest/lnd_signer_test.go index ce16240a3..1372e4502 100644 --- a/itest/lnd_signer_test.go +++ b/itest/lnd_signer_test.go @@ -13,8 +13,8 @@ import ( "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/signrpc" "github.com/lightningnetwork/lnd/lnrpc/walletrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/stretchr/testify/require" ) @@ -22,7 +22,7 @@ import ( // DeriveSharedKey. It creates an ephemeral private key, performing an ECDH with // the node's pubkey and a customized public key to check the validity of the // result. -func testDeriveSharedKey(ht *lntemp.HarnessTest) { +func testDeriveSharedKey(ht *lntest.HarnessTest) { runDeriveSharedKey(ht, ht.Alice) } @@ -30,7 +30,7 @@ func testDeriveSharedKey(ht *lntemp.HarnessTest) { // DeriveSharedKey. It creates an ephemeral private key, performing an ECDH with // the node's pubkey and a customized public key to check the validity of the // result. -func runDeriveSharedKey(ht *lntemp.HarnessTest, alice *node.HarnessNode) { +func runDeriveSharedKey(ht *lntest.HarnessTest, alice *node.HarnessNode) { // Create an ephemeral key, extracts its public key, and make a // PrivKeyECDH using the ephemeral key. ephemeralPriv, err := btcec.NewPrivateKey() @@ -194,13 +194,13 @@ func runDeriveSharedKey(ht *lntemp.HarnessTest, alice *node.HarnessNode) { // testSignOutputRaw makes sure that the SignOutputRaw RPC can be used with all // custom ways of specifying the signing key in the key descriptor/locator. -func testSignOutputRaw(ht *lntemp.HarnessTest) { +func testSignOutputRaw(ht *lntest.HarnessTest) { runSignOutputRaw(ht, ht.Alice) } // runSignOutputRaw makes sure that the SignOutputRaw RPC can be used with all // custom ways of specifying the signing key in the key descriptor/locator. -func runSignOutputRaw(ht *lntemp.HarnessTest, alice *node.HarnessNode) { +func runSignOutputRaw(ht *lntest.HarnessTest, alice *node.HarnessNode) { // For the next step, we need a public key. Let's use a special family // for this. We want this to be an index of zero. const testCustomKeyFamily = 44 @@ -272,7 +272,7 @@ func runSignOutputRaw(ht *lntemp.HarnessTest, alice *node.HarnessNode) { // assertSignOutputRaw sends coins to a p2wkh address derived from the given // target public key and then tries to spend that output again by invoking the // SignOutputRaw RPC with the key descriptor provided. -func assertSignOutputRaw(ht *lntemp.HarnessTest, +func assertSignOutputRaw(ht *lntest.HarnessTest, alice *node.HarnessNode, targetPubKey *btcec.PublicKey, keyDesc *signrpc.KeyDescriptor, sigHash txscript.SigHashType) { @@ -373,14 +373,14 @@ func assertSignOutputRaw(ht *lntemp.HarnessTest, // testSignVerifyMessage makes sure that the SignMessage RPC can be used with // all custom flags by verifying with VerifyMessage. Tests both ECDSA and // Schnorr signatures. -func testSignVerifyMessage(ht *lntemp.HarnessTest) { +func testSignVerifyMessage(ht *lntest.HarnessTest) { runSignVerifyMessage(ht, ht.Alice) } // runSignVerifyMessage makes sure that the SignMessage RPC can be used with // all custom flags by verifying with VerifyMessage. Tests both ECDSA and // Schnorr signatures. -func runSignVerifyMessage(ht *lntemp.HarnessTest, alice *node.HarnessNode) { +func runSignVerifyMessage(ht *lntest.HarnessTest, alice *node.HarnessNode) { aliceMsg := []byte("alice msg") keyLoc := &signrpc.KeyLocator{ KeyFamily: int32(keychain.KeyFamilyNodeKey), diff --git a/itest/lnd_single_hop_invoice_test.go b/itest/lnd_single_hop_invoice_test.go index ce75c42d0..8051f7bb8 100644 --- a/itest/lnd_single_hop_invoice_test.go +++ b/itest/lnd_single_hop_invoice_test.go @@ -7,20 +7,20 @@ import ( "github.com/btcsuite/btcd/btcutil" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" - "github.com/lightningnetwork/lnd/lntemp" + "github.com/lightningnetwork/lnd/lntest" "github.com/lightningnetwork/lnd/lntypes" "github.com/lightningnetwork/lnd/lnwire" "github.com/lightningnetwork/lnd/record" "github.com/stretchr/testify/require" ) -func testSingleHopInvoice(ht *lntemp.HarnessTest) { +func testSingleHopInvoice(ht *lntest.HarnessTest) { // Open a channel with 100k satoshis between Alice and Bob with Alice // being the sole funder of the channel. chanAmt := btcutil.Amount(100000) alice, bob := ht.Alice, ht.Bob cp := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{Amt: chanAmt}, + alice, bob, lntest.OpenChannelParams{Amt: chanAmt}, ) // assertAmountPaid is a helper closure that asserts the amount paid by diff --git a/itest/lnd_switch_test.go b/itest/lnd_switch_test.go index fd90be4a7..0bf71294a 100644 --- a/itest/lnd_switch_test.go +++ b/itest/lnd_switch_test.go @@ -3,8 +3,8 @@ package itest import ( "github.com/btcsuite/btcd/btcutil" "github.com/lightningnetwork/lnd/lnrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/stretchr/testify/require" ) @@ -21,11 +21,11 @@ const ( // // The general flow of this test: // 1. Carol --> Dave --> Alice --> Bob forward payment -// 2. -------X X X Bob restart sender and intermediaries +// 2. X X X Bob restart sender and intermediaries // 3. Carol <-- Dave <-- Alice <-- Bob expect settle to propagate // //nolint:dupword -func testSwitchCircuitPersistence(ht *lntemp.HarnessTest) { +func testSwitchCircuitPersistence(ht *lntest.HarnessTest) { // Setup our test scenario. We should now have four nodes running with // three channels. s := setupScenarioFourNodes(ht) @@ -95,7 +95,7 @@ func testSwitchCircuitPersistence(ht *lntemp.HarnessTest) { // 2. Carol --- Dave X Alice --- Bob disconnect intermediaries // 3. Carol --- Dave X Alice <-- Bob settle last hop // 4. Carol <-- Dave <-- Alice --- Bob reconnect, expect settle to propagate -func testSwitchOfflineDelivery(ht *lntemp.HarnessTest) { +func testSwitchOfflineDelivery(ht *lntest.HarnessTest) { // Setup our test scenario. We should now have four nodes running with // three channels. s := setupScenarioFourNodes(ht) @@ -174,7 +174,7 @@ func testSwitchOfflineDelivery(ht *lntemp.HarnessTest) { // 3. Carol --- Dave X Alice <-- Bob settle last hop // 4. Carol --- Dave X X Bob restart Alice // 5. Carol <-- Dave <-- Alice --- Bob expect settle to propagate -func testSwitchOfflineDeliveryPersistence(ht *lntemp.HarnessTest) { +func testSwitchOfflineDeliveryPersistence(ht *lntest.HarnessTest) { // Setup our test scenario. We should now have four nodes running with // three channels. s := setupScenarioFourNodes(ht) @@ -260,7 +260,7 @@ func testSwitchOfflineDeliveryPersistence(ht *lntemp.HarnessTest) { // 3. Carol --- Dave X Alice <-- Bob settle last hop // 4. Carol --- Dave X X shutdown Bob, restart Alice // 5. Carol <-- Dave <-- Alice X expect settle to propagate -func testSwitchOfflineDeliveryOutgoingOffline(ht *lntemp.HarnessTest) { +func testSwitchOfflineDeliveryOutgoingOffline(ht *lntest.HarnessTest) { // Setup our test scenario. We should now have four nodes running with // three channels. Note that we won't call the cleanUp function here as // we will manually stop the node Carol and her channel. @@ -371,13 +371,13 @@ type scenarioFourNodes struct { // // NOTE: caller needs to call cleanUp to clean the nodes and channels created // from this setup. -func setupScenarioFourNodes(ht *lntemp.HarnessTest) *scenarioFourNodes { +func setupScenarioFourNodes(ht *lntest.HarnessTest) *scenarioFourNodes { const ( chanAmt = btcutil.Amount(1000000) pushAmt = btcutil.Amount(900000) ) - params := lntemp.OpenChannelParams{ + params := lntest.OpenChannelParams{ Amt: chanAmt, PushAmt: pushAmt, } @@ -404,7 +404,7 @@ func setupScenarioFourNodes(ht *lntemp.HarnessTest) *scenarioFourNodes { ht.FundCoins(btcutil.SatoshiPerBitcoin, carol) // Open channels in batch to save blocks mined. - reqs := []*lntemp.OpenChannelRequest{ + reqs := []*lntest.OpenChannelRequest{ {Local: alice, Remote: bob, Param: params}, {Local: dave, Remote: alice, Param: params}, {Local: carol, Remote: dave, Param: params}, @@ -456,7 +456,7 @@ func setupScenarioFourNodes(ht *lntemp.HarnessTest) *scenarioFourNodes { // assertHTLCs is a helper function which asserts the desired num of // HTLCs has been seen in the nodes. -func (s *scenarioFourNodes) assertHTLCs(ht *lntemp.HarnessTest, num int) { +func (s *scenarioFourNodes) assertHTLCs(ht *lntest.HarnessTest, num int) { // Alice should have both the same number of outgoing and // incoming HTLCs. ht.AssertNumActiveHtlcs(s.alice, num*2) @@ -472,7 +472,7 @@ func (s *scenarioFourNodes) assertHTLCs(ht *lntemp.HarnessTest, num int) { // assertAmoutPaid is a helper method which takes a given paid amount // and number of payments and asserts the desired payments are made in // the four nodes. -func (s *scenarioFourNodes) assertAmoutPaid(ht *lntemp.HarnessTest, +func (s *scenarioFourNodes) assertAmoutPaid(ht *lntest.HarnessTest, amt int64, num int64) { ht.AssertAmountPaid( diff --git a/itest/lnd_taproot_test.go b/itest/lnd_taproot_test.go index a04048195..82f8c86fb 100644 --- a/itest/lnd_taproot_test.go +++ b/itest/lnd_taproot_test.go @@ -20,8 +20,8 @@ import ( "github.com/lightningnetwork/lnd/lnrpc/chainrpc" "github.com/lightningnetwork/lnd/lnrpc/signrpc" "github.com/lightningnetwork/lnd/lnrpc/walletrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/lnwallet/chainfee" "github.com/stretchr/testify/require" ) @@ -47,7 +47,7 @@ var ( // testTaproot ensures that the daemon can send to and spend from taproot (p2tr) // outputs. -func testTaproot(ht *lntemp.HarnessTest) { +func testTaproot(ht *lntest.HarnessTest) { testTaprootSendCoinsKeySpendBip86(ht, ht.Alice) testTaprootComputeInputScriptKeySpendBip86(ht, ht.Alice) testTaprootSignOutputRawScriptSpend(ht, ht.Alice) @@ -81,7 +81,7 @@ func testTaproot(ht *lntemp.HarnessTest) { // testTaprootSendCoinsKeySpendBip86 tests sending to and spending from // p2tr key spend only (BIP-0086) addresses through the SendCoins RPC which // internally uses the ComputeInputScript method for signing. -func testTaprootSendCoinsKeySpendBip86(ht *lntemp.HarnessTest, +func testTaprootSendCoinsKeySpendBip86(ht *lntest.HarnessTest, alice *node.HarnessNode) { // We'll start the test by sending Alice some coins, which she'll use to @@ -137,7 +137,7 @@ func testTaprootSendCoinsKeySpendBip86(ht *lntemp.HarnessTest, // testTaprootComputeInputScriptKeySpendBip86 tests sending to and spending from // p2tr key spend only (BIP-0086) addresses through the SendCoins RPC which // internally uses the ComputeInputScript method for signing. -func testTaprootComputeInputScriptKeySpendBip86(ht *lntemp.HarnessTest, +func testTaprootComputeInputScriptKeySpendBip86(ht *lntest.HarnessTest, alice *node.HarnessNode) { // We'll start the test by sending Alice some coins, which she'll use @@ -234,7 +234,7 @@ func testTaprootComputeInputScriptKeySpendBip86(ht *lntemp.HarnessTest, // testTaprootSignOutputRawScriptSpend tests sending to and spending from p2tr // script addresses using the script path with the SignOutputRaw RPC. -func testTaprootSignOutputRawScriptSpend(ht *lntemp.HarnessTest, +func testTaprootSignOutputRawScriptSpend(ht *lntest.HarnessTest, alice *node.HarnessNode, sigHashType ...txscript.SigHashType) { // For the next step, we need a public key. Let's use a special family @@ -392,7 +392,7 @@ func testTaprootSignOutputRawScriptSpend(ht *lntemp.HarnessTest, // testTaprootSignOutputRawKeySpendBip86 tests that a tapscript address can // also be spent using the key spend path through the SignOutputRaw RPC using a // BIP0086 key spend only commitment. -func testTaprootSignOutputRawKeySpendBip86(ht *lntemp.HarnessTest, +func testTaprootSignOutputRawKeySpendBip86(ht *lntest.HarnessTest, alice *node.HarnessNode, sigHashType ...txscript.SigHashType) { // For the next step, we need a public key. Let's use a special family @@ -490,7 +490,7 @@ func testTaprootSignOutputRawKeySpendBip86(ht *lntemp.HarnessTest, // testTaprootSignOutputRawKeySpendRootHash tests that a tapscript address can // also be spent using the key spend path through the SignOutputRaw RPC using a // tapscript root hash. -func testTaprootSignOutputRawKeySpendRootHash(ht *lntemp.HarnessTest, +func testTaprootSignOutputRawKeySpendRootHash(ht *lntest.HarnessTest, alice *node.HarnessNode) { // For the next step, we need a public key. Let's use a special family @@ -583,7 +583,7 @@ func testTaprootSignOutputRawKeySpendRootHash(ht *lntemp.HarnessTest, // testTaprootMuSig2KeySpendBip86 tests that a combined MuSig2 key can also be // used as a BIP-0086 key spend only key. -func testTaprootMuSig2KeySpendBip86(ht *lntemp.HarnessTest, +func testTaprootMuSig2KeySpendBip86(ht *lntest.HarnessTest, alice *node.HarnessNode, version signrpc.MuSig2Version) { // We're not going to commit to a script. So our taproot tweak will be @@ -711,7 +711,7 @@ func testTaprootMuSig2KeySpendBip86(ht *lntemp.HarnessTest, // testTaprootMuSig2KeySpendRootHash tests that a tapscript address can also be // spent using a MuSig2 combined key. -func testTaprootMuSig2KeySpendRootHash(ht *lntemp.HarnessTest, +func testTaprootMuSig2KeySpendRootHash(ht *lntest.HarnessTest, alice *node.HarnessNode, version signrpc.MuSig2Version) { // We're going to commit to a script as well. This is a hash lock with a @@ -843,7 +843,7 @@ func testTaprootMuSig2KeySpendRootHash(ht *lntemp.HarnessTest, // testTaprootMuSig2ScriptSpend tests that a tapscript address with an internal // key that is a MuSig2 combined key can also be spent using the script path. -func testTaprootMuSig2ScriptSpend(ht *lntemp.HarnessTest, +func testTaprootMuSig2ScriptSpend(ht *lntest.HarnessTest, alice *node.HarnessNode, version signrpc.MuSig2Version) { // We're going to commit to a script and spend the output using the @@ -926,7 +926,7 @@ func testTaprootMuSig2ScriptSpend(ht *lntemp.HarnessTest, // testTaprootMuSig2CombinedLeafKeySpend tests that a MuSig2 combined key can be // used for an OP_CHECKSIG inside a tap script leaf spend. -func testTaprootMuSig2CombinedLeafKeySpend(ht *lntemp.HarnessTest, +func testTaprootMuSig2CombinedLeafKeySpend(ht *lntest.HarnessTest, alice *node.HarnessNode, version signrpc.MuSig2Version) { // We're using the combined MuSig2 key in a script leaf. So we need to @@ -1102,7 +1102,7 @@ func testTaprootMuSig2CombinedLeafKeySpend(ht *lntemp.HarnessTest, // testTaprootImportTapscriptScriptSpend tests importing p2tr script addresses // using the script path with the full tree known. -func testTaprootImportTapscriptFullTree(ht *lntemp.HarnessTest, +func testTaprootImportTapscriptFullTree(ht *lntest.HarnessTest, alice *node.HarnessNode) { // For the next step, we need a public key. Let's use a special family @@ -1176,7 +1176,7 @@ func testTaprootImportTapscriptFullTree(ht *lntemp.HarnessTest, // testTaprootImportTapscriptPartialReveal tests importing p2tr script addresses // for which we only know part of the tree. -func testTaprootImportTapscriptPartialReveal(ht *lntemp.HarnessTest, +func testTaprootImportTapscriptPartialReveal(ht *lntest.HarnessTest, alice *node.HarnessNode) { // For the next step, we need a public key. Let's use a special family @@ -1247,7 +1247,7 @@ func testTaprootImportTapscriptPartialReveal(ht *lntemp.HarnessTest, // testTaprootImportTapscriptRootHashOnly tests importing p2tr script addresses // for which we only know the root hash. -func testTaprootImportTapscriptRootHashOnly(ht *lntemp.HarnessTest, +func testTaprootImportTapscriptRootHashOnly(ht *lntest.HarnessTest, alice *node.HarnessNode) { // For the next step, we need a public key. Let's use a special family @@ -1306,7 +1306,7 @@ func testTaprootImportTapscriptRootHashOnly(ht *lntemp.HarnessTest, // testTaprootImportTapscriptFullKey tests importing p2tr script addresses for // which we only know the full Taproot key. -func testTaprootImportTapscriptFullKey(ht *lntemp.HarnessTest, +func testTaprootImportTapscriptFullKey(ht *lntest.HarnessTest, alice *node.HarnessNode) { // For the next step, we need a public key. Let's use a special family @@ -1365,7 +1365,7 @@ func testTaprootImportTapscriptFullKey(ht *lntemp.HarnessTest, // clearWalletImportedTapscriptBalance manually assembles and then attempts to // sign a TX to sweep funds from an imported tapscript address. -func clearWalletImportedTapscriptBalance(ht *lntemp.HarnessTest, +func clearWalletImportedTapscriptBalance(ht *lntest.HarnessTest, hn *node.HarnessNode, utxo *wire.TxOut, outPoint wire.OutPoint, internalKey *btcec.PublicKey, derivationPath []uint32, rootHash []byte) { @@ -1460,7 +1460,7 @@ func testScriptSchnorrSig(t *testing.T, } // newAddrWithScript returns a new address and its pkScript. -func newAddrWithScript(ht *lntemp.HarnessTest, node *node.HarnessNode, +func newAddrWithScript(ht *lntest.HarnessTest, node *node.HarnessNode, addrType lnrpc.AddressType) (btcutil.Address, []byte) { p2wkhResp := node.RPC.NewAddress(&lnrpc.NewAddressRequest{ @@ -1479,7 +1479,7 @@ func newAddrWithScript(ht *lntemp.HarnessTest, node *node.HarnessNode, // sendToTaprootOutput sends coins to a p2tr output of the given taproot key and // mines a block to confirm the coins. -func sendToTaprootOutput(ht *lntemp.HarnessTest, hn *node.HarnessNode, +func sendToTaprootOutput(ht *lntest.HarnessTest, hn *node.HarnessNode, taprootKey *btcec.PublicKey, amt int64) (wire.OutPoint, []byte) { tapScriptAddr, err := btcutil.NewAddressTaproot( @@ -1542,7 +1542,7 @@ func sendToTaprootOutput(ht *lntemp.HarnessTest, hn *node.HarnessNode, // after checking its weight against an estimate. After asserting the given // spend request, the given sweep address' balance is verified to be seen as // funds belonging to the wallet. -func publishTxAndConfirmSweep(ht *lntemp.HarnessTest, node *node.HarnessNode, +func publishTxAndConfirmSweep(ht *lntest.HarnessTest, node *node.HarnessNode, tx *wire.MsgTx, estimatedWeight int64, spendRequest *chainrpc.SpendRequest, sweepAddr string) { @@ -1604,7 +1604,7 @@ func publishTxAndConfirmSweep(ht *lntemp.HarnessTest, node *node.HarnessNode, // confirmAddress makes sure that a transaction in the mempool spends funds to // the given address. It also checks that a confirmation notification for the // address is triggered when the transaction is mined. -func confirmAddress(ht *lntemp.HarnessTest, hn *node.HarnessNode, +func confirmAddress(ht *lntest.HarnessTest, hn *node.HarnessNode, addrString string) { // Wait until the tx that sends to the address is found. @@ -1654,7 +1654,7 @@ func confirmAddress(ht *lntemp.HarnessTest, hn *node.HarnessNode, // deriveSigningKeys derives three signing keys and returns their descriptors, // as well as the public keys in the Schnorr serialized format. -func deriveSigningKeys(ht *lntemp.HarnessTest, node *node.HarnessNode, +func deriveSigningKeys(ht *lntest.HarnessTest, node *node.HarnessNode, version signrpc.MuSig2Version) (*signrpc.KeyDescriptor, *signrpc.KeyDescriptor, *signrpc.KeyDescriptor, [][]byte) { @@ -1700,7 +1700,7 @@ func deriveSigningKeys(ht *lntemp.HarnessTest, node *node.HarnessNode, // combined into a single key. The same node is used for the three signing // participants but a separate key is generated for each session. So the result // should be the same as if it were three different nodes. -func createMuSigSessions(ht *lntemp.HarnessTest, node *node.HarnessNode, +func createMuSigSessions(ht *lntest.HarnessTest, node *node.HarnessNode, taprootTweak *signrpc.TaprootTweakDesc, keyDesc1, keyDesc2, keyDesc3 *signrpc.KeyDescriptor, allPubKeys [][]byte, version signrpc.MuSig2Version) (*btcec.PublicKey, @@ -1838,7 +1838,7 @@ func createMuSigSessions(ht *lntemp.HarnessTest, node *node.HarnessNode, // testTaprootCoopClose asserts that if both peers signal ShutdownAnySegwit, // then a taproot closing addr is used. Otherwise, we shouldn't expect one to // be used. -func testTaprootCoopClose(ht *lntemp.HarnessTest) { +func testTaprootCoopClose(ht *lntest.HarnessTest) { // We'll start by making two new nodes, and funding a channel between // them. carol := ht.NewNode("Carol", nil) @@ -1853,7 +1853,7 @@ func testTaprootCoopClose(ht *lntemp.HarnessTest) { // We'll now open a channel between Carol and Dave. chanPoint := ht.OpenChannel( - carol, dave, lntemp.OpenChannelParams{ + carol, dave, lntest.OpenChannelParams{ Amt: chanAmt, PushAmt: pushAmt, SatPerVByte: satPerVbyte, @@ -1888,7 +1888,7 @@ func testTaprootCoopClose(ht *lntemp.HarnessTest) { // We'll now open up a chanel again between Carol and Eve. chanPoint = ht.OpenChannel( - carol, eve, lntemp.OpenChannelParams{ + carol, eve, lntest.OpenChannelParams{ Amt: chanAmt, PushAmt: pushAmt, SatPerVByte: satPerVbyte, @@ -1904,7 +1904,7 @@ func testTaprootCoopClose(ht *lntemp.HarnessTest) { // testMuSig2CombineKey makes sure that combining a key with MuSig2 returns the // correct result according to the MuSig2 version specified. -func testMuSig2CombineKey(ht *lntemp.HarnessTest, alice *node.HarnessNode, +func testMuSig2CombineKey(ht *lntest.HarnessTest, alice *node.HarnessNode, version signrpc.MuSig2Version) { testVector040Key1 := hexDecode( diff --git a/itest/lnd_test.go b/itest/lnd_test.go index 0ff7294e2..cb9f60dbf 100644 --- a/itest/lnd_test.go +++ b/itest/lnd_test.go @@ -15,8 +15,8 @@ import ( "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/integration/rpctest" "github.com/lightningnetwork/lnd/lnrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/lntest/wait" "github.com/stretchr/testify/require" "google.golang.org/grpc/grpclog" @@ -90,11 +90,11 @@ func TestLightningNetworkDaemon(t *testing.T) { node.ApplyPortOffset(uint32(trancheIndex) * 1000) // Create a simple fee service. - feeService := lntemp.NewFeeService(t) + feeService := lntest.NewFeeService(t) // Get the binary path and setup the harness test. binary := getLndBinary(t) - harnessTest := lntemp.SetupHarness( + harnessTest := lntest.SetupHarness( t, binary, *dbBackendFlag, feeService, ) defer harnessTest.Stop() @@ -156,7 +156,7 @@ func TestLightningNetworkDaemon(t *testing.T) { // getTestCaseSplitTranche returns the sub slice of the test cases that should // be run as the current split tranche as well as the index and slice offset of // the tranche. -func getTestCaseSplitTranche() ([]*lntemp.TestCase, uint, uint) { +func getTestCaseSplitTranche() ([]*lntest.TestCase, uint, uint) { numTranches := defaultSplitTranches if testCasesSplitTranches != nil { numTranches = *testCasesSplitTranches diff --git a/itest/lnd_trackpayments_test.go b/itest/lnd_trackpayments_test.go index 2554471ef..55224b87b 100644 --- a/itest/lnd_trackpayments_test.go +++ b/itest/lnd_trackpayments_test.go @@ -7,17 +7,17 @@ import ( "github.com/btcsuite/btcd/btcutil" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" - "github.com/lightningnetwork/lnd/lntemp" + "github.com/lightningnetwork/lnd/lntest" "github.com/stretchr/testify/require" ) // testTrackPayments tests whether a client that calls the TrackPayments api // receives payment updates. -func testTrackPayments(ht *lntemp.HarnessTest) { +func testTrackPayments(ht *lntest.HarnessTest) { // Open a channel between alice and bob. alice, bob := ht.Alice, ht.Bob channel := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{ + alice, bob, lntest.OpenChannelParams{ Amt: btcutil.Amount(300000), }, ) diff --git a/itest/lnd_wallet_import_test.go b/itest/lnd_wallet_import_test.go index 818ff311d..afd96a352 100644 --- a/itest/lnd_wallet_import_test.go +++ b/itest/lnd_wallet_import_test.go @@ -16,8 +16,8 @@ import ( "github.com/lightningnetwork/lnd/funding" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/walletrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/lnwallet" "github.com/stretchr/testify/require" ) @@ -51,7 +51,7 @@ func walletToLNAddrType(t *testing.T, // newExternalAddr generates a new external address of an imported account for a // pair of nodes, where one acts as the funder and the other as the signer. -func newExternalAddr(ht *lntemp.HarnessTest, funder, signer *node.HarnessNode, +func newExternalAddr(ht *lntest.HarnessTest, funder, signer *node.HarnessNode, importedAccount string, addrType walletrpc.AddressType) string { // We'll generate a new address for Carol from Dave's node to receive @@ -125,7 +125,7 @@ func assertOutputScriptType(t *testing.T, expType txscript.ScriptClass, // psbtSendFromImportedAccount attempts to fund a PSBT from the given imported // account, originating from the source node to the destination. -func psbtSendFromImportedAccount(ht *lntemp.HarnessTest, srcNode, destNode, +func psbtSendFromImportedAccount(ht *lntest.HarnessTest, srcNode, destNode, signer *node.HarnessNode, account string, accountAddrType walletrpc.AddressType) { @@ -236,7 +236,7 @@ func psbtSendFromImportedAccount(ht *lntemp.HarnessTest, srcNode, destNode, // node. To ensure the channel is operational before closing it, a test payment // is made. Several balance assertions are made along the way for the sake of // correctness. -func fundChanAndCloseFromImportedAccount(ht *lntemp.HarnessTest, srcNode, +func fundChanAndCloseFromImportedAccount(ht *lntest.HarnessTest, srcNode, destNode, signer *node.HarnessNode, account string, accountAddrType walletrpc.AddressType, utxoAmt, chanSize int64) { @@ -256,7 +256,7 @@ func fundChanAndCloseFromImportedAccount(ht *lntemp.HarnessTest, srcNode, // The source node will then fund the channel through a PSBT shim. pendingChanID := ht.Random32Bytes() chanUpdates, rawPsbt := ht.OpenChannelPsbt( - srcNode, destNode, lntemp.OpenChannelParams{ + srcNode, destNode, lntest.OpenChannelParams{ Amt: btcutil.Amount(chanSize), FundingShim: &lnrpc.FundingShim{ Shim: &lnrpc.FundingShim_PsbtShim{ @@ -463,7 +463,7 @@ func fundChanAndCloseFromImportedAccount(ht *lntemp.HarnessTest, srcNode, // testWalletImportAccount tests that an imported account can fund transactions // and channels through PSBTs, by having one node (the one with the imported // account) craft the transactions and another node act as the signer. -func testWalletImportAccount(ht *lntemp.HarnessTest) { +func testWalletImportAccount(ht *lntest.HarnessTest) { testCases := []struct { name string addrType walletrpc.AddressType @@ -491,7 +491,7 @@ func testWalletImportAccount(ht *lntemp.HarnessTest) { for _, tc := range testCases { tc := tc success := ht.Run(tc.name, func(tt *testing.T) { - testFunc := func(ht *lntemp.HarnessTest) { + testFunc := func(ht *lntest.HarnessTest) { testWalletImportAccountScenario( ht, tc.addrType, ) @@ -499,7 +499,7 @@ func testWalletImportAccount(ht *lntemp.HarnessTest) { st := ht.Subtest(tt) - st.RunTestCase(&lntemp.TestCase{ + st.RunTestCase(&lntest.TestCase{ Name: tc.name, TestFunc: testFunc, }) @@ -515,7 +515,7 @@ func testWalletImportAccount(ht *lntemp.HarnessTest) { } } -func testWalletImportAccountScenario(ht *lntemp.HarnessTest, +func testWalletImportAccountScenario(ht *lntest.HarnessTest, addrType walletrpc.AddressType) { // We'll start our test by having two nodes, Carol and Dave. Carol's @@ -529,7 +529,7 @@ func testWalletImportAccountScenario(ht *lntemp.HarnessTest, runWalletImportAccountScenario(ht, addrType, carol, dave) } -func runWalletImportAccountScenario(ht *lntemp.HarnessTest, +func runWalletImportAccountScenario(ht *lntest.HarnessTest, addrType walletrpc.AddressType, carol, dave *node.HarnessNode) { const utxoAmt int64 = btcutil.SatoshiPerBitcoin @@ -619,7 +619,7 @@ func runWalletImportAccountScenario(ht *lntemp.HarnessTest, // testWalletImportPubKey tests that an imported public keys can fund // transactions and channels through PSBTs, by having one node (the one with the // imported account) craft the transactions and another node act as the signer. -func testWalletImportPubKey(ht *lntemp.HarnessTest) { +func testWalletImportPubKey(ht *lntest.HarnessTest) { testCases := []struct { name string addrType walletrpc.AddressType @@ -642,7 +642,7 @@ func testWalletImportPubKey(ht *lntemp.HarnessTest) { for _, tc := range testCases { tc := tc success := ht.Run(tc.name, func(tt *testing.T) { - testFunc := func(ht *lntemp.HarnessTest) { + testFunc := func(ht *lntest.HarnessTest) { testWalletImportPubKeyScenario( ht, tc.addrType, ) @@ -650,7 +650,7 @@ func testWalletImportPubKey(ht *lntemp.HarnessTest) { st := ht.Subtest(tt) - st.RunTestCase(&lntemp.TestCase{ + st.RunTestCase(&lntest.TestCase{ Name: tc.name, TestFunc: testFunc, }) @@ -666,7 +666,7 @@ func testWalletImportPubKey(ht *lntemp.HarnessTest) { } } -func testWalletImportPubKeyScenario(ht *lntemp.HarnessTest, +func testWalletImportPubKeyScenario(ht *lntest.HarnessTest, addrType walletrpc.AddressType) { const utxoAmt int64 = btcutil.SatoshiPerBitcoin diff --git a/itest/lnd_wipe_fwdpkgs_test.go b/itest/lnd_wipe_fwdpkgs_test.go index 0f74d4fab..35953f5cb 100644 --- a/itest/lnd_wipe_fwdpkgs_test.go +++ b/itest/lnd_wipe_fwdpkgs_test.go @@ -5,7 +5,7 @@ import ( "github.com/lightningnetwork/lnd/chainreg" "github.com/lightningnetwork/lnd/lnrpc" - "github.com/lightningnetwork/lnd/lntemp" + "github.com/lightningnetwork/lnd/lntest" "github.com/stretchr/testify/require" ) @@ -21,7 +21,7 @@ type pendingChan *lnrpc.PendingChannelsResponse_PendingChannel // packages are wiped. // - Bob coop closes the channel Bob->Carol, and checks from both Bob PoVs // that the forwarding packages are wiped. -func testWipeForwardingPackages(ht *lntemp.HarnessTest) { +func testWipeForwardingPackages(ht *lntest.HarnessTest) { const ( chanAmt = 10e6 paymentAmt = 10e4 @@ -41,12 +41,12 @@ func testWipeForwardingPackages(ht *lntemp.HarnessTest) { // Open a channel between Alice and Bob. chanPointAB := ht.OpenChannel( - alice, bob, lntemp.OpenChannelParams{Amt: chanAmt}, + alice, bob, lntest.OpenChannelParams{Amt: chanAmt}, ) // Open a channel between Bob and Carol. chanPointBC := ht.OpenChannel( - bob, carol, lntemp.OpenChannelParams{Amt: chanAmt}, + bob, carol, lntest.OpenChannelParams{Amt: chanAmt}, ) // Before we continue, make sure Alice has seen the channel between Bob diff --git a/itest/lnd_wumbo_channels_test.go b/itest/lnd_wumbo_channels_test.go index 5a5ba6627..18d170acc 100644 --- a/itest/lnd_wumbo_channels_test.go +++ b/itest/lnd_wumbo_channels_test.go @@ -3,7 +3,7 @@ package itest import ( "github.com/btcsuite/btcd/btcutil" "github.com/lightningnetwork/lnd/funding" - "github.com/lightningnetwork/lnd/lntemp" + "github.com/lightningnetwork/lnd/lntest" "github.com/lightningnetwork/lnd/lnwallet" ) @@ -11,7 +11,7 @@ import ( // acceptances will allow a wumbo channel to be created. Additionally, if a // node is running with mini channels only enabled, then they should reject any // inbound wumbo channel requests. -func testWumboChannels(ht *lntemp.HarnessTest) { +func testWumboChannels(ht *lntest.HarnessTest) { // With all the channel types exercised, we'll now make sure the wumbo // signalling support works properly. // @@ -33,7 +33,7 @@ func testWumboChannels(ht *lntemp.HarnessTest) { // The test should indicate a failure due to the channel being too // large. ht.OpenChannelAssertErr( - wumboNode, miniNode, lntemp.OpenChannelParams{Amt: chanAmt}, + wumboNode, miniNode, lntest.OpenChannelParams{Amt: chanAmt}, lnwallet.ErrChanTooLarge(chanAmt, funding.MaxBtcFundingAmount), ) @@ -46,7 +46,7 @@ func testWumboChannels(ht *lntemp.HarnessTest) { // Creating a wumbo channel between these two nodes should succeed. ht.EnsureConnected(wumboNode, wumboNode2) chanPoint := ht.OpenChannel( - wumboNode, wumboNode2, lntemp.OpenChannelParams{Amt: chanAmt}, + wumboNode, wumboNode2, lntest.OpenChannelParams{Amt: chanAmt}, ) ht.CloseChannel(wumboNode, chanPoint) } diff --git a/itest/lnd_zero_conf_test.go b/itest/lnd_zero_conf_test.go index 4482874e3..3eae1ebe9 100644 --- a/itest/lnd_zero_conf_test.go +++ b/itest/lnd_zero_conf_test.go @@ -13,9 +13,9 @@ import ( "github.com/lightningnetwork/lnd/chainreg" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" - "github.com/lightningnetwork/lnd/lntemp" - "github.com/lightningnetwork/lnd/lntemp/node" - "github.com/lightningnetwork/lnd/lntemp/rpc" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" + "github.com/lightningnetwork/lnd/lntest/rpc" "github.com/lightningnetwork/lnd/lntest/wait" "github.com/lightningnetwork/lnd/lnwire" "github.com/stretchr/testify/require" @@ -23,7 +23,7 @@ import ( // testZeroConfChannelOpen tests that opening a zero-conf channel works and // sending payments also works. -func testZeroConfChannelOpen(ht *lntemp.HarnessTest) { +func testZeroConfChannelOpen(ht *lntest.HarnessTest) { // Since option-scid-alias is opt-in, the provided harness nodes will // not have the feature bit set. Also need to set anchors as those are // default-off in itests. @@ -39,7 +39,7 @@ func testZeroConfChannelOpen(ht *lntemp.HarnessTest) { // We'll open a regular public channel between Bob and Carol here. chanAmt := btcutil.Amount(1_000_000) - p := lntemp.OpenChannelParams{ + p := lntest.OpenChannelParams{ Amt: chanAmt, } chanPoint := ht.OpenChannel(bob, carol, p) @@ -58,7 +58,7 @@ func testZeroConfChannelOpen(ht *lntemp.HarnessTest) { go acceptChannel(ht.T, true, acceptStream) // Open a private zero-conf anchors channel of 1M satoshis. - params := lntemp.OpenChannelParams{ + params := lntest.OpenChannelParams{ Amt: chanAmt, Private: true, CommitmentType: lnrpc.CommitmentType_ANCHORS, @@ -191,7 +191,7 @@ func testZeroConfChannelOpen(ht *lntemp.HarnessTest) { // testOptionScidAlias checks that opening an option_scid_alias channel-type // channel or w/o the channel-type works properly. -func testOptionScidAlias(ht *lntemp.HarnessTest) { +func testOptionScidAlias(ht *lntest.HarnessTest) { type scidTestCase struct { name string @@ -234,7 +234,7 @@ func testOptionScidAlias(ht *lntemp.HarnessTest) { } } -func optionScidAliasScenario(ht *lntemp.HarnessTest, chantype, private bool) { +func optionScidAliasScenario(ht *lntest.HarnessTest, chantype, private bool) { // Option-scid-alias is opt-in, as is anchors. scidAliasArgs := []string{ "--protocol.option-scid-alias", @@ -256,7 +256,7 @@ func optionScidAliasScenario(ht *lntemp.HarnessTest, chantype, private bool) { chanAmt := btcutil.Amount(1_000_000) - params := lntemp.OpenChannelParams{ + params := lntest.OpenChannelParams{ Amt: chanAmt, Private: private, CommitmentType: lnrpc.CommitmentType_ANCHORS, @@ -282,7 +282,7 @@ func optionScidAliasScenario(ht *lntemp.HarnessTest, chantype, private bool) { // We'll now open a regular public channel between Bob and Carol and // assert that Bob can pay Dave. We'll also assert that the invoice // Dave issues has the startingAlias as a hop hint. - p := lntemp.OpenChannelParams{ + p := lntest.OpenChannelParams{ Amt: chanAmt, } fundingPoint2 := ht.OpenChannel(bob, carol, p) @@ -409,7 +409,7 @@ func waitForZeroConfGraphChange(hn *node.HarnessNode, // testUpdateChannelPolicyScidAlias checks that option-scid-alias, zero-conf // channel-types, and option-scid-alias feature-bit-only channels have the // expected graph and that payments work when updating the channel policy. -func testUpdateChannelPolicyScidAlias(ht *lntemp.HarnessTest) { +func testUpdateChannelPolicyScidAlias(ht *lntest.HarnessTest) { tests := []struct { name string @@ -461,7 +461,7 @@ func testUpdateChannelPolicyScidAlias(ht *lntemp.HarnessTest) { } } -func testPrivateUpdateAlias(ht *lntemp.HarnessTest, +func testPrivateUpdateAlias(ht *lntest.HarnessTest, zeroConf, scidAliasType, private bool) { // We'll create a new node Eve that will not have option-scid-alias @@ -494,7 +494,7 @@ func testPrivateUpdateAlias(ht *lntemp.HarnessTest, chanAmt := btcutil.Amount(1_000_000) - p := lntemp.OpenChannelParams{ + p := lntest.OpenChannelParams{ Amt: chanAmt, PushAmt: chanAmt / 2, } @@ -508,7 +508,7 @@ func testPrivateUpdateAlias(ht *lntemp.HarnessTest, go acceptChannel(ht.T, zeroConf, acceptStream) // Open a private channel, optionally specifying a channel-type. - params := lntemp.OpenChannelParams{ + params := lntest.OpenChannelParams{ Amt: chanAmt, Private: private, CommitmentType: lnrpc.CommitmentType_ANCHORS, @@ -541,7 +541,7 @@ func testPrivateUpdateAlias(ht *lntemp.HarnessTest, FeeRateMilliMsat: testFeeBase * feeRate, TimeLockDelta: timeLockDelta, MinHtlc: 1000, // default value - MaxHtlcMsat: lntemp.CalculateMaxHtlc(chanAmt), + MaxHtlcMsat: lntest.CalculateMaxHtlc(chanAmt), } // Assert that Dave receives Carol's policy update. @@ -567,7 +567,7 @@ func testPrivateUpdateAlias(ht *lntemp.HarnessTest, FeeRateMilliMsat: testFeeBase * feeRate, TimeLockDelta: timeLockDelta, MinHtlc: 1000, - MaxHtlcMsat: lntemp.CalculateMaxHtlc(chanAmt), + MaxHtlcMsat: lntest.CalculateMaxHtlc(chanAmt), } // Assert that Carol receives Dave's policy update. @@ -654,7 +654,7 @@ func testPrivateUpdateAlias(ht *lntemp.HarnessTest, FeeRateMilliMsat: testFeeBase * feeRate, TimeLockDelta: timeLockDelta, MinHtlc: 1000, - MaxHtlcMsat: lntemp.CalculateMaxHtlc(chanAmt), + MaxHtlcMsat: lntest.CalculateMaxHtlc(chanAmt), } // Assert Dave receives Carol's policy update. @@ -743,7 +743,7 @@ func testPrivateUpdateAlias(ht *lntemp.HarnessTest, FeeRateMilliMsat: testFeeBase * feeRate, TimeLockDelta: timeLockDelta, MinHtlc: 1000, - MaxHtlcMsat: lntemp.CalculateMaxHtlc(chanAmt), + MaxHtlcMsat: lntest.CalculateMaxHtlc(chanAmt), } // Assert Dave and optionally Eve receives Carol's update. @@ -763,7 +763,7 @@ func testPrivateUpdateAlias(ht *lntemp.HarnessTest, // testOptionScidUpgrade tests that toggling the option-scid-alias feature bit // correctly upgrades existing channels. -func testOptionScidUpgrade(ht *lntemp.HarnessTest) { +func testOptionScidUpgrade(ht *lntest.HarnessTest) { bob := ht.Bob // Start carol with anchors only. @@ -787,7 +787,7 @@ func testOptionScidUpgrade(ht *lntemp.HarnessTest) { chanAmt := btcutil.Amount(1_000_000) - p := lntemp.OpenChannelParams{ + p := lntest.OpenChannelParams{ Amt: chanAmt, PushAmt: chanAmt / 2, Private: true, @@ -797,7 +797,7 @@ func testOptionScidUpgrade(ht *lntemp.HarnessTest) { // Bob will open a channel to Carol now. ht.EnsureConnected(bob, carol) - p = lntemp.OpenChannelParams{ + p = lntest.OpenChannelParams{ Amt: chanAmt, } fundingPoint2 := ht.OpenChannel(bob, carol, p) @@ -891,7 +891,7 @@ func acceptChannel(t *testing.T, zeroConf bool, stream rpc.AcceptorClient) { // testZeroConfReorg tests that a reorg does not cause a zero-conf channel to // be deleted from the channel graph. This was previously the case due to logic // in the function DisconnectBlockAtHeight. -func testZeroConfReorg(ht *lntemp.HarnessTest) { +func testZeroConfReorg(ht *lntest.HarnessTest) { if ht.IsNeutrinoBackend() { ht.Skipf("skipping zero-conf reorg test for neutrino backend") } @@ -925,7 +925,7 @@ func testZeroConfReorg(ht *lntemp.HarnessTest) { go acceptChannel(ht.T, true, acceptStream) // Open a private zero-conf anchors channel of 1M satoshis. - params := lntemp.OpenChannelParams{ + params := lntest.OpenChannelParams{ Amt: btcutil.Amount(1_000_000), CommitmentType: lnrpc.CommitmentType_ANCHORS, ZeroConf: true, @@ -959,7 +959,7 @@ func testZeroConfReorg(ht *lntemp.HarnessTest) { // First, we'll setup a new miner that we can use to cause a reorg. tempLogDir := ".tempminerlogs" logFilename := "output-open_channel_reorg-temp_miner.log" - tempMiner := lntemp.NewTempMiner( + tempMiner := lntest.NewTempMiner( ht.Context(), ht.T, tempLogDir, logFilename, ) defer tempMiner.Stop() diff --git a/lntemp/README.md b/lntest/README.md similarity index 100% rename from lntemp/README.md rename to lntest/README.md diff --git a/lntest/bitcoind_common.go b/lntest/bitcoind_common.go index 320d89345..8cac2e5af 100644 --- a/lntest/bitcoind_common.go +++ b/lntest/bitcoind_common.go @@ -14,7 +14,7 @@ import ( "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/rpcclient" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest/node" ) // logDirPattern is the pattern of the name of the temporary log directory. diff --git a/lntest/btcd.go b/lntest/btcd.go index 817936709..be5f52f58 100644 --- a/lntest/btcd.go +++ b/lntest/btcd.go @@ -15,7 +15,7 @@ import ( "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/integration/rpctest" "github.com/btcsuite/btcd/rpcclient" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest/node" ) // logDirPattern is the pattern of the name of the temporary log directory. diff --git a/lntemp/fee_service.go b/lntest/fee_service.go similarity index 98% rename from lntemp/fee_service.go rename to lntest/fee_service.go index e89809c71..a707ff2a3 100644 --- a/lntemp/fee_service.go +++ b/lntest/fee_service.go @@ -1,4 +1,4 @@ -package lntemp +package lntest import ( "context" @@ -9,7 +9,7 @@ import ( "sync" "testing" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/lnwallet/chainfee" "github.com/stretchr/testify/require" ) diff --git a/lntemp/harness.go b/lntest/harness.go similarity index 99% rename from lntemp/harness.go rename to lntest/harness.go index 9a656723c..23c7ab9a0 100644 --- a/lntemp/harness.go +++ b/lntest/harness.go @@ -1,4 +1,4 @@ -package lntemp +package lntest import ( "context" @@ -17,8 +17,8 @@ import ( "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" "github.com/lightningnetwork/lnd/lnrpc/walletrpc" - "github.com/lightningnetwork/lnd/lntemp/node" - "github.com/lightningnetwork/lnd/lntemp/rpc" + "github.com/lightningnetwork/lnd/lntest/node" + "github.com/lightningnetwork/lnd/lntest/rpc" "github.com/lightningnetwork/lnd/lntest/wait" "github.com/lightningnetwork/lnd/lnwallet/chainfee" "github.com/lightningnetwork/lnd/lnwire" diff --git a/lntemp/harness_assertion.go b/lntest/harness_assertion.go similarity index 99% rename from lntemp/harness_assertion.go rename to lntest/harness_assertion.go index 9b61c9186..7e94d371f 100644 --- a/lntemp/harness_assertion.go +++ b/lntest/harness_assertion.go @@ -1,4 +1,4 @@ -package lntemp +package lntest import ( "bytes" @@ -23,8 +23,8 @@ import ( "github.com/lightningnetwork/lnd/lnrpc/invoicesrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" "github.com/lightningnetwork/lnd/lnrpc/walletrpc" - "github.com/lightningnetwork/lnd/lntemp/node" - "github.com/lightningnetwork/lnd/lntemp/rpc" + "github.com/lightningnetwork/lnd/lntest/node" + "github.com/lightningnetwork/lnd/lntest/rpc" "github.com/lightningnetwork/lnd/lntest/wait" "github.com/lightningnetwork/lnd/lntypes" "github.com/stretchr/testify/require" diff --git a/lntemp/harness_miner.go b/lntest/harness_miner.go similarity index 99% rename from lntemp/harness_miner.go rename to lntest/harness_miner.go index 851423438..53ef4154d 100644 --- a/lntemp/harness_miner.go +++ b/lntest/harness_miner.go @@ -1,4 +1,4 @@ -package lntemp +package lntest import ( "bytes" @@ -18,7 +18,7 @@ import ( "github.com/btcsuite/btcd/integration/rpctest" "github.com/btcsuite/btcd/rpcclient" "github.com/btcsuite/btcd/wire" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/lntest/wait" "github.com/stretchr/testify/require" ) diff --git a/lntemp/harness_node_manager.go b/lntest/harness_node_manager.go similarity index 99% rename from lntemp/harness_node_manager.go rename to lntest/harness_node_manager.go index 4ed365a33..bb8e8bdd7 100644 --- a/lntemp/harness_node_manager.go +++ b/lntest/harness_node_manager.go @@ -1,4 +1,4 @@ -package lntemp +package lntest import ( "context" @@ -8,7 +8,7 @@ import ( "testing" "github.com/lightningnetwork/lnd/lnrpc" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/lntest/wait" ) diff --git a/lntemp/harness_setup.go b/lntest/harness_setup.go similarity index 95% rename from lntemp/harness_setup.go rename to lntest/harness_setup.go index 4c14a4479..666f59b2b 100644 --- a/lntemp/harness_setup.go +++ b/lntest/harness_setup.go @@ -1,4 +1,4 @@ -package lntemp +package lntest import ( "context" @@ -6,8 +6,7 @@ import ( "testing" "github.com/btcsuite/btcd/integration/rpctest" - "github.com/lightningnetwork/lnd/lntemp/node" - "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/node" "github.com/stretchr/testify/require" ) @@ -85,7 +84,7 @@ func prepareMiner(ctxt context.Context, t *testing.T) *HarnessMiner { func prepareChainBackend(t *testing.T, minerAddr string) (node.BackendConfig, func()) { - chainBackend, cleanUp, err := lntest.NewBackend( + chainBackend, cleanUp, err := NewBackend( minerAddr, harnessNetParams, ) require.NoError(t, err, "new backend") diff --git a/lntest/neutrino.go b/lntest/neutrino.go index 9ea18a4db..11f13612f 100644 --- a/lntest/neutrino.go +++ b/lntest/neutrino.go @@ -7,7 +7,7 @@ import ( "fmt" "github.com/btcsuite/btcd/chaincfg" - "github.com/lightningnetwork/lnd/lntemp/node" + "github.com/lightningnetwork/lnd/lntest/node" ) // NeutrinoBackendConfig is an implementation of the BackendConfig interface diff --git a/lntemp/node/config.go b/lntest/node/config.go similarity index 100% rename from lntemp/node/config.go rename to lntest/node/config.go diff --git a/lntemp/node/harness_node.go b/lntest/node/harness_node.go similarity index 99% rename from lntemp/node/harness_node.go rename to lntest/node/harness_node.go index ebba81e84..db7d78857 100644 --- a/lntemp/node/harness_node.go +++ b/lntest/node/harness_node.go @@ -18,7 +18,7 @@ import ( "github.com/jackc/pgx/v4/pgxpool" "github.com/lightningnetwork/lnd/lnrpc" - "github.com/lightningnetwork/lnd/lntemp/rpc" + "github.com/lightningnetwork/lnd/lntest/rpc" "github.com/lightningnetwork/lnd/lntest/wait" "github.com/lightningnetwork/lnd/macaroons" "google.golang.org/grpc" diff --git a/lntemp/node/state.go b/lntest/node/state.go similarity index 99% rename from lntemp/node/state.go rename to lntest/node/state.go index 2c3c45f02..bab178bd0 100644 --- a/lntemp/node/state.go +++ b/lntest/node/state.go @@ -9,7 +9,7 @@ import ( "github.com/btcsuite/btcd/wire" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/walletrpc" - "github.com/lightningnetwork/lnd/lntemp/rpc" + "github.com/lightningnetwork/lnd/lntest/rpc" "github.com/lightningnetwork/lnd/lnutils" ) diff --git a/lntemp/node/watcher.go b/lntest/node/watcher.go similarity index 99% rename from lntemp/node/watcher.go rename to lntest/node/watcher.go index dd36e3202..e89bcf6d1 100644 --- a/lntemp/node/watcher.go +++ b/lntest/node/watcher.go @@ -11,7 +11,7 @@ import ( "github.com/btcsuite/btcd/wire" "github.com/lightningnetwork/lnd/lnrpc" - "github.com/lightningnetwork/lnd/lntemp/rpc" + "github.com/lightningnetwork/lnd/lntest/rpc" "github.com/lightningnetwork/lnd/lntest/wait" "github.com/lightningnetwork/lnd/lnutils" ) diff --git a/lntemp/rpc/chain_kit.go b/lntest/rpc/chain_kit.go similarity index 100% rename from lntemp/rpc/chain_kit.go rename to lntest/rpc/chain_kit.go diff --git a/lntemp/rpc/chain_notifier.go b/lntest/rpc/chain_notifier.go similarity index 100% rename from lntemp/rpc/chain_notifier.go rename to lntest/rpc/chain_notifier.go diff --git a/lntemp/rpc/harness_rpc.go b/lntest/rpc/harness_rpc.go similarity index 100% rename from lntemp/rpc/harness_rpc.go rename to lntest/rpc/harness_rpc.go diff --git a/lntemp/rpc/invoices.go b/lntest/rpc/invoices.go similarity index 100% rename from lntemp/rpc/invoices.go rename to lntest/rpc/invoices.go diff --git a/lntemp/rpc/lnd.go b/lntest/rpc/lnd.go similarity index 100% rename from lntemp/rpc/lnd.go rename to lntest/rpc/lnd.go diff --git a/lntemp/rpc/neutrino_kit.go b/lntest/rpc/neutrino_kit.go similarity index 100% rename from lntemp/rpc/neutrino_kit.go rename to lntest/rpc/neutrino_kit.go diff --git a/lntemp/rpc/peers.go b/lntest/rpc/peers.go similarity index 100% rename from lntemp/rpc/peers.go rename to lntest/rpc/peers.go diff --git a/lntemp/rpc/router.go b/lntest/rpc/router.go similarity index 100% rename from lntemp/rpc/router.go rename to lntest/rpc/router.go diff --git a/lntemp/rpc/signer.go b/lntest/rpc/signer.go similarity index 100% rename from lntemp/rpc/signer.go rename to lntest/rpc/signer.go diff --git a/lntemp/rpc/state.go b/lntest/rpc/state.go similarity index 100% rename from lntemp/rpc/state.go rename to lntest/rpc/state.go diff --git a/lntemp/rpc/wallet_kit.go b/lntest/rpc/wallet_kit.go similarity index 100% rename from lntemp/rpc/wallet_kit.go rename to lntest/rpc/wallet_kit.go diff --git a/lntemp/rpc/wallet_unlocker.go b/lntest/rpc/wallet_unlocker.go similarity index 100% rename from lntemp/rpc/wallet_unlocker.go rename to lntest/rpc/wallet_unlocker.go diff --git a/lntemp/rpc/watchtower.go b/lntest/rpc/watchtower.go similarity index 100% rename from lntemp/rpc/watchtower.go rename to lntest/rpc/watchtower.go diff --git a/lntemp/utils.go b/lntest/utils.go similarity index 99% rename from lntemp/utils.go rename to lntest/utils.go index acb5b77e5..23cd41a14 100644 --- a/lntemp/utils.go +++ b/lntest/utils.go @@ -1,4 +1,4 @@ -package lntemp +package lntest import ( "fmt"