mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-07 14:00:08 +02: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:
@ -233,19 +233,34 @@ func testAsyncPayments(ht *lntest.HarnessTest) {
|
|||||||
ht.EnsureConnected(alice, bob)
|
ht.EnsureConnected(alice, bob)
|
||||||
ht.FundCoins(btcutil.SatoshiPerBitcoin, alice)
|
ht.FundCoins(btcutil.SatoshiPerBitcoin, alice)
|
||||||
|
|
||||||
runAsyncPayments(ht, alice, bob)
|
runAsyncPayments(ht, alice, bob, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// runAsyncPayments tests the performance of the async payments.
|
// 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
|
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
|
// First establish a channel with a capacity equals to the overall
|
||||||
// amount of payments, between Alice and Bob, at the end of the test
|
// amount of payments, between Alice and Bob, at the end of the test
|
||||||
// Alice should send all money from her side to Bob.
|
// Alice should send all money from her side to Bob.
|
||||||
channelCapacity := btcutil.Amount(paymentAmt * 2000)
|
|
||||||
chanPoint := ht.OpenChannel(
|
chanPoint := ht.OpenChannel(
|
||||||
alice, bob, lntest.OpenChannelParams{Amt: channelCapacity},
|
alice, bob, chanArgs,
|
||||||
)
|
)
|
||||||
|
|
||||||
info := ht.QueryChannelByChanPoint(alice, chanPoint)
|
info := ht.QueryChannelByChanPoint(alice, chanPoint)
|
||||||
|
@ -60,6 +60,7 @@ func testRemoteSigner(ht *lntest.HarnessTest) {
|
|||||||
name string
|
name string
|
||||||
randomSeed bool
|
randomSeed bool
|
||||||
sendCoins bool
|
sendCoins bool
|
||||||
|
commitType lnrpc.CommitmentType
|
||||||
fn func(tt *lntest.HarnessTest,
|
fn func(tt *lntest.HarnessTest,
|
||||||
wo, carol *node.HarnessNode)
|
wo, carol *node.HarnessNode)
|
||||||
}
|
}
|
||||||
@ -94,8 +95,19 @@ func testRemoteSigner(ht *lntest.HarnessTest) {
|
|||||||
name: "async payments",
|
name: "async payments",
|
||||||
sendCoins: true,
|
sendCoins: true,
|
||||||
fn: func(tt *lntest.HarnessTest, wo, carol *node.HarnessNode) {
|
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",
|
name: "shared key",
|
||||||
fn: func(tt *lntest.HarnessTest, wo, carol *node.HarnessNode) {
|
fn: func(tt *lntest.HarnessTest, wo, carol *node.HarnessNode) {
|
||||||
@ -199,11 +211,18 @@ func testRemoteSigner(ht *lntest.HarnessTest) {
|
|||||||
require.NoError(st, err)
|
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
|
// WatchOnly is the node that has a watch-only wallet and uses
|
||||||
// the Signer node for any operation that requires access to
|
// the Signer node for any operation that requires access to
|
||||||
// private keys.
|
// private keys.
|
||||||
watchOnly := st.NewNodeRemoteSigner(
|
watchOnly := st.NewNodeRemoteSigner(
|
||||||
"WatchOnly", []string{
|
"WatchOnly", append([]string{
|
||||||
"--remotesigner.enable",
|
"--remotesigner.enable",
|
||||||
fmt.Sprintf(
|
fmt.Sprintf(
|
||||||
"--remotesigner.rpchost=localhost:%d",
|
"--remotesigner.rpchost=localhost:%d",
|
||||||
@ -217,7 +236,8 @@ func testRemoteSigner(ht *lntest.HarnessTest) {
|
|||||||
"--remotesigner.macaroonpath=%s",
|
"--remotesigner.macaroonpath=%s",
|
||||||
signer.Cfg.AdminMacPath,
|
signer.Cfg.AdminMacPath,
|
||||||
),
|
),
|
||||||
}, password, &lnrpc.WatchOnly{
|
}, commitArgs...),
|
||||||
|
password, &lnrpc.WatchOnly{
|
||||||
MasterKeyBirthdayTimestamp: 0,
|
MasterKeyBirthdayTimestamp: 0,
|
||||||
MasterKeyFingerprint: nil,
|
MasterKeyFingerprint: nil,
|
||||||
Accounts: watchOnlyAccounts,
|
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)
|
st.EnsureConnected(watchOnly, carol)
|
||||||
|
|
||||||
return signer, watchOnly, carol
|
return signer, watchOnly, carol
|
||||||
|
Reference in New Issue
Block a user