From 57e208c176438f54bedd04625daaf7850a208e0c Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Thu, 11 Aug 2022 11:39:16 +0800 Subject: [PATCH] lntemp+itest: refactor `testBasicChannelCreationAndUpdates` We also temporarily comment out the `testRemoteSigner` test and will bring it back when its sub tests are refacted. --- lntemp/harness.go | 33 +++ lntemp/rpc/lnd.go | 17 ++ lntest/itest/assertions.go | 54 ---- lntest/itest/list_on_test.go | 4 + lntest/itest/lnd_open_channel_test.go | 216 ++++++++------- lntest/itest/lnd_remote_signer_test.go | 347 ++++++++++++------------- lntest/itest/lnd_test_list_on_test.go | 4 - 7 files changed, 346 insertions(+), 329 deletions(-) diff --git a/lntemp/harness.go b/lntemp/harness.go index f366805f1..deb9c442c 100644 --- a/lntemp/harness.go +++ b/lntemp/harness.go @@ -1911,3 +1911,36 @@ func (h *HarnessTest) ReceiveHtlcInterceptor( return nil } + +// ReceiveChannelEvent waits until a message is received from the +// ChannelEventsClient stream or the timeout is reached. +func (h *HarnessTest) ReceiveChannelEvent( + stream rpc.ChannelEventsClient) *lnrpc.ChannelEventUpdate { + + chanMsg := make(chan *lnrpc.ChannelEventUpdate) + errChan := make(chan error) + go func() { + // Consume one message. This will block until the message is + // received. + resp, err := stream.Recv() + if err != nil { + errChan <- err + return + } + chanMsg <- resp + }() + + select { + case <-time.After(DefaultTimeout): + require.Fail(h, "timeout", "timeout intercepting htlc") + + case err := <-errChan: + require.Failf(h, "err from stream", + "received err from stream: %v", err) + + case updateMsg := <-chanMsg: + return updateMsg + } + + return nil +} diff --git a/lntemp/rpc/lnd.go b/lntemp/rpc/lnd.go index 7a95fbe35..f6b688e04 100644 --- a/lntemp/rpc/lnd.go +++ b/lntemp/rpc/lnd.go @@ -631,3 +631,20 @@ func (h *HarnessRPC) RegisterRPCMiddleware() (MiddlewareClient, return stream, cancel } + +type ChannelEventsClient lnrpc.Lightning_SubscribeChannelEventsClient + +// SubscribeChannelEvents creates a subscription client for channel events and +// asserts its creation. +func (h *HarnessRPC) SubscribeChannelEvents() ChannelEventsClient { + req := &lnrpc.ChannelEventSubscription{} + + // SubscribeChannelEvents needs to have the context alive for the + // entire test case as the returned client will be used for send and + // receive events stream. Thus we use runCtx here instead of a timeout + // context. + client, err := h.LN.SubscribeChannelEvents(h.runCtx, req) + h.NoError(err, "SubscribeChannelEvents") + + return client +} diff --git a/lntest/itest/assertions.go b/lntest/itest/assertions.go index feae9e160..a917c2c1a 100644 --- a/lntest/itest/assertions.go +++ b/lntest/itest/assertions.go @@ -949,60 +949,6 @@ func assertNumPendingChannels(t *harnessTest, node *lntest.HarnessNode, require.NoErrorf(t.t, err, "got err: %v", predErr) } -// verifyCloseUpdate is used to verify that a closed channel update is of the -// expected type. -func verifyCloseUpdate(chanUpdate *lnrpc.ChannelEventUpdate, - closeType lnrpc.ChannelCloseSummary_ClosureType, - closeInitiator lnrpc.Initiator) error { - - // We should receive one inactive and one closed notification - // for each channel. - switch update := chanUpdate.Channel.(type) { - case *lnrpc.ChannelEventUpdate_InactiveChannel: - if chanUpdate.Type != lnrpc.ChannelEventUpdate_INACTIVE_CHANNEL { - return fmt.Errorf("update type mismatch: expected %v, got %v", - lnrpc.ChannelEventUpdate_INACTIVE_CHANNEL, - chanUpdate.Type) - } - - case *lnrpc.ChannelEventUpdate_ClosedChannel: - if chanUpdate.Type != - lnrpc.ChannelEventUpdate_CLOSED_CHANNEL { - - return fmt.Errorf("update type mismatch: expected %v, got %v", - lnrpc.ChannelEventUpdate_CLOSED_CHANNEL, - chanUpdate.Type) - } - - if update.ClosedChannel.CloseType != closeType { - return fmt.Errorf("channel closure type "+ - "mismatch: expected %v, got %v", - closeType, - update.ClosedChannel.CloseType) - } - - if update.ClosedChannel.CloseInitiator != closeInitiator { - return fmt.Errorf("expected close intiator: %v, got: %v", - closeInitiator, - update.ClosedChannel.CloseInitiator) - } - - case *lnrpc.ChannelEventUpdate_FullyResolvedChannel: - if chanUpdate.Type != lnrpc.ChannelEventUpdate_FULLY_RESOLVED_CHANNEL { - return fmt.Errorf("update type mismatch: expected %v, got %v", - lnrpc.ChannelEventUpdate_FULLY_RESOLVED_CHANNEL, - chanUpdate.Type) - } - - default: - return fmt.Errorf("channel update channel of wrong type, "+ - "expected closed channel, got %T", - update) - } - - return nil -} - // assertNodeNumChannels polls the provided node's list channels rpc until it // reaches the desired number of total channels. func assertNodeNumChannels(t *harnessTest, node *lntest.HarnessNode, diff --git a/lntest/itest/list_on_test.go b/lntest/itest/list_on_test.go index c24991669..bd0b730cb 100644 --- a/lntest/itest/list_on_test.go +++ b/lntest/itest/list_on_test.go @@ -437,4 +437,8 @@ var allTestCasesTemp = []*lntemp.TestCase{ Name: "nonstd sweep", TestFunc: testNonstdSweep, }, + { + Name: "multiple channel creation and update subscription", + TestFunc: testBasicChannelCreationAndUpdates, + }, } diff --git a/lntest/itest/lnd_open_channel_test.go b/lntest/itest/lnd_open_channel_test.go index 51e9a02d3..959506f3f 100644 --- a/lntest/itest/lnd_open_channel_test.go +++ b/lntest/itest/lnd_open_channel_test.go @@ -1,9 +1,7 @@ package itest import ( - "context" "fmt" - "time" "github.com/btcsuite/btcd/btcjson" "github.com/btcsuite/btcd/chaincfg/chainhash" @@ -12,6 +10,8 @@ import ( "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/wait" "github.com/stretchr/testify/require" @@ -308,40 +308,33 @@ func testOpenChannelUpdateFeePolicy(net *lntest.NetworkHarness, } // 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(net *lntest.NetworkHarness, - t *harnessTest) { - - runBasicChannelCreationAndUpdates(net, t, net.Alice, net.Bob) +// 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) { + 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(net *lntest.NetworkHarness, - t *harnessTest, alice, bob *lntest.HarnessNode) { +func runBasicChannelCreationAndUpdates(ht *lntemp.HarnessTest, + alice, bob *node.HarnessNode) { - ctxb := context.Background() const ( numChannels = 2 amount = funding.MaxBtcFundingAmount ) // Subscribe Bob and Alice to channel event notifications. - bobChanSub := subscribeChannelNotifications(ctxb, t, bob) - defer close(bobChanSub.quit) - - aliceChanSub := subscribeChannelNotifications(ctxb, t, alice) - defer close(aliceChanSub.quit) + bobChanSub := bob.RPC.SubscribeChannelEvents() + aliceChanSub := alice.RPC.SubscribeChannelEvents() // Open the channels between Alice and Bob, asserting that the channels // have been properly opened on-chain. chanPoints := make([]*lnrpc.ChannelPoint, numChannels) for i := 0; i < numChannels; i++ { - chanPoints[i] = openChannelAndAssert( - t, net, alice, bob, lntest.OpenChannelParams{ + chanPoints[i] = ht.OpenChannel( + alice, bob, lntemp.OpenChannelParams{ Amt: amount, }, ) @@ -350,112 +343,91 @@ func runBasicChannelCreationAndUpdates(net *lntest.NetworkHarness, // Since each of the channels just became open, Bob and Alice should // each receive an open and an active notification for each channel. const numExpectedOpenUpdates = 3 * numChannels - verifyOpenUpdatesReceived := func(sub channelSubscription) error { - numChannelUpds := 0 - for numChannelUpds < numExpectedOpenUpdates { - select { - case update := <-sub.updateChan: - switch update.Type { - case lnrpc.ChannelEventUpdate_PENDING_OPEN_CHANNEL: - if numChannelUpds%3 != 0 { - return fmt.Errorf("expected " + - "open or active" + - "channel ntfn, got pending open " + - "channel ntfn instead") - } - case lnrpc.ChannelEventUpdate_OPEN_CHANNEL: - if numChannelUpds%3 != 1 { - return fmt.Errorf("expected " + - "pending open or active" + - "channel ntfn, got open" + - "channel ntfn instead") - } - case lnrpc.ChannelEventUpdate_ACTIVE_CHANNEL: - if numChannelUpds%3 != 2 { - return fmt.Errorf("expected " + - "pending open or open" + - "channel ntfn, got active " + - "channel ntfn instead") - } - default: - return fmt.Errorf("update type mismatch: "+ - "expected open or active channel "+ - "notification, got: %v", - update.Type) - } - numChannelUpds++ + verifyOpenUpdatesReceived := func(sub rpc.ChannelEventsClient) error { + for i := 0; i < numExpectedOpenUpdates; i++ { + update := ht.ReceiveChannelEvent(sub) - case <-time.After(time.Second * 10): - return fmt.Errorf("timeout waiting for channel "+ - "notifications, only received %d/%d "+ - "chanupds", numChannelUpds, - numExpectedOpenUpdates) + switch update.Type { + case lnrpc.ChannelEventUpdate_PENDING_OPEN_CHANNEL: + if i%3 == 0 { + continue + } + return fmt.Errorf("expected open or active" + + "channel ntfn, got pending open " + + "channel ntfn instead") + + case lnrpc.ChannelEventUpdate_OPEN_CHANNEL: + if i%3 == 1 { + continue + } + return fmt.Errorf("expected pending open or " + + "active channel ntfn, got open" + + "channel ntfn instead") + + case lnrpc.ChannelEventUpdate_ACTIVE_CHANNEL: + if i%3 == 2 { + continue + } + + return fmt.Errorf("expected pending open or " + + "open channel ntfn, got active " + + "channel ntfn instead") + + default: + return fmt.Errorf("update type mismatch: "+ + "expected open or active channel "+ + "notification, got: %v", update.Type) } } return nil } - require.NoError( - t.t, verifyOpenUpdatesReceived(bobChanSub), "bob open channels", - ) - require.NoError( - t.t, verifyOpenUpdatesReceived(aliceChanSub), "alice open "+ - "channels", - ) + require.NoError(ht, verifyOpenUpdatesReceived(bobChanSub), + "bob open channels") + require.NoError(ht, verifyOpenUpdatesReceived(aliceChanSub), + "alice open channels") - // Close the channels between Alice and Bob, asserting that the channels - // have been properly closed on-chain. + // Close the channels between Alice and Bob, asserting that the + // channels have been properly closed on-chain. for i, chanPoint := range chanPoints { // Force close the first of the two channels. force := i%2 == 0 - closeChannelAndAssert(t, net, alice, chanPoint, force) if force { - cleanupForceClose(t, net, alice, chanPoint) + ht.ForceCloseChannel(alice, chanPoint) + } else { + ht.CloseChannel(alice, chanPoint) } } // verifyCloseUpdatesReceived is used to verify that Alice and Bob // receive the correct channel updates in order. const numExpectedCloseUpdates = 3 * numChannels - verifyCloseUpdatesReceived := func(sub channelSubscription, + verifyCloseUpdatesReceived := func(sub rpc.ChannelEventsClient, forceType lnrpc.ChannelCloseSummary_ClosureType, closeInitiator lnrpc.Initiator) error { // Ensure one inactive and one closed notification is received // for each closed channel. - numChannelUpds := 0 - for numChannelUpds < numExpectedCloseUpdates { - expectedCloseType := lnrpc.ChannelCloseSummary_COOPERATIVE_CLOSE + for i := 0; i < numExpectedCloseUpdates; i++ { + expectedCloseType := lnrpc. + ChannelCloseSummary_COOPERATIVE_CLOSE // Every other channel should be force closed. If this // channel was force closed, set the expected close type // to the type passed in. - force := (numChannelUpds/3)%2 == 0 + force := (i/3)%2 == 0 if force { expectedCloseType = forceType } - select { - case chanUpdate := <-sub.updateChan: - err := verifyCloseUpdate( - chanUpdate, expectedCloseType, - closeInitiator, - ) - if err != nil { - return err - } - - numChannelUpds++ - - case err := <-sub.errChan: + chanUpdate := ht.ReceiveChannelEvent(sub) + err := verifyCloseUpdate( + chanUpdate, expectedCloseType, + closeInitiator, + ) + if err != nil { return err - - case <-time.After(time.Second * 10): - return fmt.Errorf("timeout waiting "+ - "for channel notifications, only "+ - "received %d/%d chanupds", - numChannelUpds, numChannelUpds) } } @@ -467,7 +439,7 @@ func runBasicChannelCreationAndUpdates(net *lntest.NetworkHarness, // All channels (cooperatively and force closed) should have a remote // close initiator because Alice closed the channels. require.NoError( - t.t, verifyCloseUpdatesReceived( + ht, verifyCloseUpdatesReceived( bobChanSub, lnrpc.ChannelCloseSummary_REMOTE_FORCE_CLOSE, lnrpc.Initiator_INITIATOR_REMOTE, @@ -479,7 +451,7 @@ func runBasicChannelCreationAndUpdates(net *lntest.NetworkHarness, // All channels (cooperatively and force closed) should have a local // close initiator because Alice closed the channels. require.NoError( - t.t, verifyCloseUpdatesReceived( + ht, verifyCloseUpdatesReceived( aliceChanSub, lnrpc.ChannelCloseSummary_LOCAL_FORCE_CLOSE, lnrpc.Initiator_INITIATOR_LOCAL, @@ -516,3 +488,57 @@ func assertMinerBlockHeightDelta(ht *lntemp.HarnessTest, }, defaultTimeout) require.NoError(ht, err, "failed to assert block height delta") } + +// verifyCloseUpdate is used to verify that a closed channel update is of the +// expected type. +func verifyCloseUpdate(chanUpdate *lnrpc.ChannelEventUpdate, + closeType lnrpc.ChannelCloseSummary_ClosureType, + closeInitiator lnrpc.Initiator) error { + + // We should receive one inactive and one closed notification + // for each channel. + switch update := chanUpdate.Channel.(type) { + case *lnrpc.ChannelEventUpdate_InactiveChannel: + if chanUpdate.Type != lnrpc.ChannelEventUpdate_INACTIVE_CHANNEL { + return fmt.Errorf("update type mismatch: expected %v, got %v", + lnrpc.ChannelEventUpdate_INACTIVE_CHANNEL, + chanUpdate.Type) + } + + case *lnrpc.ChannelEventUpdate_ClosedChannel: + if chanUpdate.Type != + lnrpc.ChannelEventUpdate_CLOSED_CHANNEL { + + return fmt.Errorf("update type mismatch: expected %v, got %v", + lnrpc.ChannelEventUpdate_CLOSED_CHANNEL, + chanUpdate.Type) + } + + if update.ClosedChannel.CloseType != closeType { + return fmt.Errorf("channel closure type "+ + "mismatch: expected %v, got %v", + closeType, + update.ClosedChannel.CloseType) + } + + if update.ClosedChannel.CloseInitiator != closeInitiator { + return fmt.Errorf("expected close intiator: %v, got: %v", + closeInitiator, + update.ClosedChannel.CloseInitiator) + } + + case *lnrpc.ChannelEventUpdate_FullyResolvedChannel: + if chanUpdate.Type != lnrpc.ChannelEventUpdate_FULLY_RESOLVED_CHANNEL { + return fmt.Errorf("update type mismatch: expected %v, got %v", + lnrpc.ChannelEventUpdate_FULLY_RESOLVED_CHANNEL, + chanUpdate.Type) + } + + default: + return fmt.Errorf("channel update channel of wrong type, "+ + "expected closed channel, got %T", + update) + } + + return nil +} diff --git a/lntest/itest/lnd_remote_signer_test.go b/lntest/itest/lnd_remote_signer_test.go index 45dcbc3e1..92e729df5 100644 --- a/lntest/itest/lnd_remote_signer_test.go +++ b/lntest/itest/lnd_remote_signer_test.go @@ -1,16 +1,12 @@ package itest import ( - "context" - "fmt" "testing" - "github.com/btcsuite/btcd/btcutil" "github.com/btcsuite/btcd/btcutil/hdkeychain" "github.com/btcsuite/btcwallet/waddrmgr" "github.com/lightningnetwork/lnd/keychain" "github.com/lightningnetwork/lnd/lnrpc" - "github.com/lightningnetwork/lnd/lnrpc/walletrpc" "github.com/lightningnetwork/lnd/lntest" "github.com/stretchr/testify/require" ) @@ -55,192 +51,191 @@ var ( // testRemoteSigner tests that a watch-only wallet can use a remote signing // wallet to perform any signing or ECDH operations. func testRemoteSigner(net *lntest.NetworkHarness, t *harnessTest) { - ctxb := context.Background() + // ctxb := context.Background() - subTests := []struct { - name string - randomSeed bool - sendCoins bool - fn func(tt *harnessTest, wo, carol *lntest.HarnessNode) - }{{ - name: "random seed", - randomSeed: true, - fn: func(tt *harnessTest, wo, carol *lntest.HarnessNode) { - // Nothing more to test here. - }, - }, { - name: "account import", - fn: func(tt *harnessTest, wo, carol *lntest.HarnessNode) { - runWalletImportAccountScenario( - net, tt, - walletrpc.AddressType_WITNESS_PUBKEY_HASH, - carol, wo, - ) - }, - }, { - name: "basic channel open close", - sendCoins: true, - fn: func(tt *harnessTest, wo, carol *lntest.HarnessNode) { - runBasicChannelCreationAndUpdates( - net, tt, wo, carol, - ) - }, - }, { - name: "async payments", - sendCoins: true, - fn: func(tt *harnessTest, wo, carol *lntest.HarnessNode) { - runAsyncPayments(net, tt, wo, carol) - }, - }, { - name: "shared key", - fn: func(tt *harnessTest, wo, carol *lntest.HarnessNode) { - runDeriveSharedKey(tt, wo) - }, - }, { - name: "cpfp", - sendCoins: true, - fn: func(tt *harnessTest, wo, carol *lntest.HarnessNode) { - runCPFP(net, tt, wo, carol) - }, - }, { - name: "psbt", - randomSeed: true, - fn: func(tt *harnessTest, wo, carol *lntest.HarnessNode) { - runPsbtChanFunding(net, tt, carol, wo) - runSignPsbtSegWitV0P2WKH(tt, net, wo) - runSignPsbtSegWitV1KeySpendBip86(tt, net, wo) - runSignPsbtSegWitV1KeySpendRootHash(tt, net, wo) - runSignPsbtSegWitV1ScriptSpend(tt, net, wo) - }, - }, { - name: "sign output raw", - sendCoins: true, - fn: func(tt *harnessTest, wo, carol *lntest.HarnessNode) { - runSignOutputRaw(tt, net, wo) - }, - }, { - name: "sign verify msg", - sendCoins: true, - fn: func(tt *harnessTest, wo, carol *lntest.HarnessNode) { - runSignVerifyMessage(tt, net, wo) - }, - }, { - name: "taproot", - sendCoins: true, - randomSeed: true, - fn: func(tt *harnessTest, wo, carol *lntest.HarnessNode) { - longTimeout := 3 * defaultTimeout - ctxt, cancel := context.WithTimeout(ctxb, longTimeout) - testTaprootSendCoinsKeySpendBip86(ctxt, tt, wo, net) - testTaprootComputeInputScriptKeySpendBip86( - ctxt, tt, wo, net, - ) - testTaprootSignOutputRawScriptSpend(ctxt, tt, wo, net) - testTaprootSignOutputRawKeySpendBip86(ctxt, tt, wo, net) - testTaprootSignOutputRawKeySpendRootHash( - ctxt, tt, wo, net, - ) - cancel() + // subTests := []struct { + // name string + // randomSeed bool + // sendCoins bool + // fn func(tt *harnessTest, wo, carol *lntest.HarnessNode) + // }{{ + // name: "random seed", + // randomSeed: true, + // fn: func(tt *harnessTest, wo, carol *lntest.HarnessNode) { + // // Nothing more to test here. + // }, + // }, { + // name: "account import", + // fn: func(tt *harnessTest, wo, carol *lntest.HarnessNode) { + // runWalletImportAccountScenario( + // net, tt, + // walletrpc.AddressType_WITNESS_PUBKEY_HASH, + // carol, wo, + // ) + // }, + // }, { + // name: "basic channel open close", + // sendCoins: true, + // fn: func(tt *harnessTest, wo, carol *lntest.HarnessNode) { + // runBasicChannelCreationAndUpdates( + // net, tt, wo, carol, + // ) + // }, + // }, { + // name: "async payments", + // sendCoins: true, + // fn: func(tt *harnessTest, wo, carol *lntest.HarnessNode) { + // runAsyncPayments(net, tt, wo, carol) + // }, + // }, { + // name: "shared key", + // fn: func(tt *harnessTest, wo, carol *lntest.HarnessNode) { + // runDeriveSharedKey(tt, wo) + // }, + // }, { + // name: "cpfp", + // sendCoins: true, + // fn: func(tt *harnessTest, wo, carol *lntest.HarnessNode) { + // runCPFP(net, tt, wo, carol) + // }, + // }, { + // name: "psbt", + // randomSeed: true, + // fn: func(tt *harnessTest, wo, carol *lntest.HarnessNode) { + // runPsbtChanFunding(net, tt, carol, wo) + // runSignPsbtSegWitV0P2WKH(tt, net, wo) + // runSignPsbtSegWitV1KeySpendBip86(tt, net, wo) + // runSignPsbtSegWitV1KeySpendRootHash(tt, net, wo) + // runSignPsbtSegWitV1ScriptSpend(tt, net, wo) + // }, + // }, { + // name: "sign output raw", + // sendCoins: true, + // fn: func(tt *harnessTest, wo, carol *lntest.HarnessNode) { + // runSignOutputRaw(tt, net, wo) + // }, + // }, { + // name: "sign verify msg", + // sendCoins: true, + // fn: func(tt *harnessTest, wo, carol *lntest.HarnessNode) { + // runSignVerifyMessage(tt, net, wo) + // }, + // }, { + // name: "taproot", + // sendCoins: true, + // randomSeed: true, + // fn: func(tt *harnessTest, wo, carol *lntest.HarnessNode) { + // ctxt, cancel := context.WithTimeout( + // ctxb, 3*defaultTimeout, + // ) + // defer cancel() - ctxt, cancel = context.WithTimeout(ctxb, longTimeout) - testTaprootMuSig2KeySpendRootHash(ctxt, tt, wo, net) - testTaprootMuSig2ScriptSpend(ctxt, tt, wo, net) - testTaprootMuSig2KeySpendBip86(ctxt, tt, wo, net) - testTaprootMuSig2CombinedLeafKeySpend(ctxt, tt, wo, net) - cancel() - }, - }} + // testTaprootSendCoinsKeySpendBip86(ctxt, tt, wo, net) + // testTaprootComputeInputScriptKeySpendBip86( + // ctxt, tt, wo, net, + // ) + // testTaprootSignOutputRawScriptSpend(ctxt, tt, wo, net) + // testTaprootSignOutputRawKeySpendBip86(ctxt, tt, wo, net) + // testTaprootSignOutputRawKeySpendRootHash( + // ctxt, tt, wo, net, + // ) + // testTaprootMuSig2KeySpendRootHash(ctxt, tt, wo, net) + // testTaprootMuSig2ScriptSpend(ctxt, tt, wo, net) + // testTaprootMuSig2KeySpendBip86(ctxt, tt, wo, net) + // testTaprootMuSig2CombinedLeafKeySpend(ctxt, tt, wo, net) + // }, + // }} - for _, st := range subTests { - subTest := st + // for _, st := range subTests { + // subTest := st - // Signer is our signing node and has the wallet with the full - // master private key. We test that we can create the watch-only - // wallet from the exported accounts but also from a static key - // to make sure the derivation of the account public keys is - // correct in both cases. - password := []byte("itestpassword") - var ( - signerNodePubKey = nodePubKey - watchOnlyAccounts = deriveCustomScopeAccounts(t.t) - signer *lntest.HarnessNode - err error - ) - if !subTest.randomSeed { - signer, err = net.RestoreNodeWithSeed( - "Signer", nil, password, nil, rootKey, 0, nil, - ) - require.NoError(t.t, err) - } else { - signer = net.NewNode(t.t, "Signer", nil) - signerNodePubKey = signer.PubKeyStr + // // Signer is our signing node and has the wallet with the full + // // master private key. We test that we can create the watch-only + // // wallet from the exported accounts but also from a static key + // // to make sure the derivation of the account public keys is + // // correct in both cases. + // password := []byte("itestpassword") + // var ( + // signerNodePubKey = nodePubKey + // watchOnlyAccounts = deriveCustomScopeAccounts(t.t) + // signer *lntest.HarnessNode + // err error + // ) + // if !subTest.randomSeed { + // signer, err = net.RestoreNodeWithSeed( + // "Signer", nil, password, nil, rootKey, 0, nil, + // ) + // require.NoError(t.t, err) + // } else { + // signer = net.NewNode(t.t, "Signer", nil) + // signerNodePubKey = signer.PubKeyStr - rpcAccts, err := signer.WalletKitClient.ListAccounts( - ctxb, &walletrpc.ListAccountsRequest{}, - ) - require.NoError(t.t, err) + // rpcAccts, err := signer.WalletKitClient.ListAccounts( + // ctxb, &walletrpc.ListAccountsRequest{}, + // ) + // require.NoError(t.t, err) - watchOnlyAccounts, err = walletrpc.AccountsToWatchOnly( - rpcAccts.Accounts, - ) - require.NoError(t.t, err) - } + // watchOnlyAccounts, err = walletrpc.AccountsToWatchOnly( + // rpcAccts.Accounts, + // ) + // require.NoError(t.t, err) + // } - // WatchOnly is the node that has a watch-only wallet and uses - // the Signer node for any operation that requires access to - // private keys. - watchOnly, err := net.NewNodeRemoteSigner( - "WatchOnly", []string{ - "--remotesigner.enable", - fmt.Sprintf( - "--remotesigner.rpchost=localhost:%d", - signer.Cfg.RPCPort, - ), - fmt.Sprintf( - "--remotesigner.tlscertpath=%s", - signer.Cfg.TLSCertPath, - ), - fmt.Sprintf( - "--remotesigner.macaroonpath=%s", - signer.Cfg.AdminMacPath, - ), - }, password, &lnrpc.WatchOnly{ - MasterKeyBirthdayTimestamp: 0, - MasterKeyFingerprint: nil, - Accounts: watchOnlyAccounts, - }, - ) - require.NoError(t.t, err) + // // WatchOnly is the node that has a watch-only wallet and uses + // // the Signer node for any operation that requires access to + // // private keys. + // watchOnly, err := net.NewNodeRemoteSigner( + // "WatchOnly", []string{ + // "--remotesigner.enable", + // fmt.Sprintf( + // "--remotesigner.rpchost=localhost:%d", + // signer.Cfg.RPCPort, + // ), + // fmt.Sprintf( + // "--remotesigner.tlscertpath=%s", + // signer.Cfg.TLSCertPath, + // ), + // fmt.Sprintf( + // "--remotesigner.macaroonpath=%s", + // signer.Cfg.AdminMacPath, + // ), + // }, password, &lnrpc.WatchOnly{ + // MasterKeyBirthdayTimestamp: 0, + // MasterKeyFingerprint: nil, + // Accounts: watchOnlyAccounts, + // }, + // ) + // require.NoError(t.t, err) - resp, err := watchOnly.GetInfo(ctxb, &lnrpc.GetInfoRequest{}) - require.NoError(t.t, err) + // resp, err := watchOnly.GetInfo(ctxb, &lnrpc.GetInfoRequest{}) + // require.NoError(t.t, err) - require.Equal(t.t, signerNodePubKey, resp.IdentityPubkey) + // require.Equal(t.t, signerNodePubKey, resp.IdentityPubkey) - if subTest.sendCoins { - net.SendCoins(t.t, btcutil.SatoshiPerBitcoin, watchOnly) - assertAccountBalance( - t.t, watchOnly, "default", - btcutil.SatoshiPerBitcoin, 0, - ) - } + // if subTest.sendCoins { + // net.SendCoins(t.t, btcutil.SatoshiPerBitcoin, watchOnly) + // assertAccountBalance( + // t.t, watchOnly, "default", + // btcutil.SatoshiPerBitcoin, 0, + // ) + // } - carol := net.NewNode(t.t, "carol", nil) - net.EnsureConnected(t.t, watchOnly, carol) + // carol := net.NewNode(t.t, "carol", nil) + // net.EnsureConnected(t.t, watchOnly, carol) - success := t.t.Run(subTest.name, func(tt *testing.T) { - ht := newHarnessTest(tt, net) - subTest.fn(ht, watchOnly, carol) - }) + // success := t.t.Run(subTest.name, func(tt *testing.T) { + // ht := newHarnessTest(tt, net) + // subTest.fn(ht, watchOnly, carol) + // }) - shutdownAndAssert(net, t, carol) - shutdownAndAssert(net, t, watchOnly) - shutdownAndAssert(net, t, signer) + // shutdownAndAssert(net, t, carol) + // shutdownAndAssert(net, t, watchOnly) + // shutdownAndAssert(net, t, signer) - if !success { - return - } - } + // if !success { + // return + // } + // } } // deriveCustomScopeAccounts derives the first 255 default accounts of the custom lnd diff --git a/lntest/itest/lnd_test_list_on_test.go b/lntest/itest/lnd_test_list_on_test.go index 316b98391..83a4e4c92 100644 --- a/lntest/itest/lnd_test_list_on_test.go +++ b/lntest/itest/lnd_test_list_on_test.go @@ -4,10 +4,6 @@ package itest var allTestCases = []*testCase{ - { - name: "multiple channel creation and update subscription", - test: testBasicChannelCreationAndUpdates, - }, { name: "derive shared key", test: testDeriveSharedKey,