From 6c3a55d89c2068fe9fdf3ea98c6b59daad212a33 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Fri, 15 Sep 2023 18:23:11 -0700 Subject: [PATCH] itest: add remote signer test case for taproot chans This ensures that taproot chans can be used with the remote signer configuration. --- itest/lnd_payment_test.go | 23 +++++++++++++++++++---- itest/lnd_remote_signer_test.go | 28 ++++++++++++++++++++++++---- 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/itest/lnd_payment_test.go b/itest/lnd_payment_test.go index 631399326..610d35d59 100644 --- a/itest/lnd_payment_test.go +++ b/itest/lnd_payment_test.go @@ -233,19 +233,34 @@ func testAsyncPayments(ht *lntest.HarnessTest) { ht.EnsureConnected(alice, bob) ht.FundCoins(btcutil.SatoshiPerBitcoin, alice) - runAsyncPayments(ht, alice, bob) + runAsyncPayments(ht, alice, bob, nil) } // runAsyncPayments tests the performance of the async payments. -func runAsyncPayments(ht *lntest.HarnessTest, alice, bob *node.HarnessNode) { +func runAsyncPayments(ht *lntest.HarnessTest, alice, bob *node.HarnessNode, + commitType *lnrpc.CommitmentType) { + const paymentAmt = 100 + channelCapacity := btcutil.Amount(paymentAmt * 2000) + + chanArgs := lntest.OpenChannelParams{ + Amt: channelCapacity, + } + + if commitType != nil { + chanArgs.CommitmentType = *commitType + + if *commitType == lnrpc.CommitmentType_SIMPLE_TAPROOT { + chanArgs.Private = true + } + } + // First establish a channel with a capacity equals to the overall // amount of payments, between Alice and Bob, at the end of the test // Alice should send all money from her side to Bob. - channelCapacity := btcutil.Amount(paymentAmt * 2000) chanPoint := ht.OpenChannel( - alice, bob, lntest.OpenChannelParams{Amt: channelCapacity}, + alice, bob, chanArgs, ) info := ht.QueryChannelByChanPoint(alice, chanPoint) diff --git a/itest/lnd_remote_signer_test.go b/itest/lnd_remote_signer_test.go index c3cd260c5..b9c96bb00 100644 --- a/itest/lnd_remote_signer_test.go +++ b/itest/lnd_remote_signer_test.go @@ -60,6 +60,7 @@ func testRemoteSigner(ht *lntest.HarnessTest) { name string randomSeed bool sendCoins bool + commitType lnrpc.CommitmentType fn func(tt *lntest.HarnessTest, wo, carol *node.HarnessNode) } @@ -94,8 +95,19 @@ func testRemoteSigner(ht *lntest.HarnessTest) { name: "async payments", sendCoins: true, fn: func(tt *lntest.HarnessTest, wo, carol *node.HarnessNode) { - runAsyncPayments(tt, wo, carol) + runAsyncPayments(tt, wo, carol, nil) }, + }, { + name: "async payments taproot", + sendCoins: true, + fn: func(tt *lntest.HarnessTest, wo, carol *node.HarnessNode) { + commitType := lnrpc.CommitmentType_SIMPLE_TAPROOT + + runAsyncPayments( + tt, wo, carol, &commitType, + ) + }, + commitType: lnrpc.CommitmentType_SIMPLE_TAPROOT, }, { name: "shared key", fn: func(tt *lntest.HarnessTest, wo, carol *node.HarnessNode) { @@ -199,11 +211,18 @@ func testRemoteSigner(ht *lntest.HarnessTest) { require.NoError(st, err) } + var commitArgs []string + if subTest.commitType == lnrpc.CommitmentType_SIMPLE_TAPROOT { + commitArgs = lntest.NodeArgsForCommitType( + subTest.commitType, + ) + } + // 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 := st.NewNodeRemoteSigner( - "WatchOnly", []string{ + "WatchOnly", append([]string{ "--remotesigner.enable", fmt.Sprintf( "--remotesigner.rpchost=localhost:%d", @@ -217,7 +236,8 @@ func testRemoteSigner(ht *lntest.HarnessTest) { "--remotesigner.macaroonpath=%s", signer.Cfg.AdminMacPath, ), - }, password, &lnrpc.WatchOnly{ + }, commitArgs...), + password, &lnrpc.WatchOnly{ MasterKeyBirthdayTimestamp: 0, MasterKeyFingerprint: nil, Accounts: watchOnlyAccounts, @@ -235,7 +255,7 @@ func testRemoteSigner(ht *lntest.HarnessTest) { ) } - carol := st.NewNode("carol", nil) + carol := st.NewNode("carol", commitArgs) st.EnsureConnected(watchOnly, carol) return signer, watchOnly, carol