mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-13 11:09:23 +01:00
itest: add remote signer test case for taproot chans
This ensures that taproot chans can be used with the remote signer configuration.
This commit is contained in:
parent
8405590152
commit
6c3a55d89c
2 changed files with 43 additions and 8 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue