mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-25 04:12:29 +02:00
itest: use ht.CreateSimpleNetwork
whenever applicable
So we won't forget to assert the topology after opening a chain of channels.
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/lightningnetwork/lnd/lnrpc"
|
"github.com/lightningnetwork/lnd/lnrpc"
|
||||||
"github.com/lightningnetwork/lnd/lnrpc/routerrpc"
|
"github.com/lightningnetwork/lnd/lnrpc/routerrpc"
|
||||||
"github.com/lightningnetwork/lnd/lntest"
|
"github.com/lightningnetwork/lnd/lntest"
|
||||||
|
"github.com/lightningnetwork/lnd/lntest/node"
|
||||||
"github.com/lightningnetwork/lnd/lntest/rpc"
|
"github.com/lightningnetwork/lnd/lntest/rpc"
|
||||||
"github.com/lightningnetwork/lnd/lntest/wait"
|
"github.com/lightningnetwork/lnd/lntest/wait"
|
||||||
"github.com/lightningnetwork/lnd/lntypes"
|
"github.com/lightningnetwork/lnd/lntypes"
|
||||||
@@ -24,37 +25,18 @@ func testExperimentalEndorsement(ht *lntest.HarnessTest) {
|
|||||||
// testEndorsement sets up a 5 hop network and tests propagation of
|
// testEndorsement sets up a 5 hop network and tests propagation of
|
||||||
// experimental endorsement signals.
|
// experimental endorsement signals.
|
||||||
func testEndorsement(ht *lntest.HarnessTest, aliceEndorse bool) {
|
func testEndorsement(ht *lntest.HarnessTest, aliceEndorse bool) {
|
||||||
alice := ht.NewNodeWithCoins("Alice", nil)
|
cfg := node.CfgAnchor
|
||||||
bob := ht.NewNodeWithCoins("Bob", nil)
|
carolCfg := append(
|
||||||
carol := ht.NewNode(
|
[]string{"--protocol.no-experimental-endorsement"}, cfg...,
|
||||||
"carol", []string{"--protocol.no-experimental-endorsement"},
|
|
||||||
)
|
)
|
||||||
dave := ht.NewNode("dave", nil)
|
cfgs := [][]string{cfg, cfg, carolCfg, cfg, cfg}
|
||||||
eve := ht.NewNode("eve", nil)
|
|
||||||
|
|
||||||
ht.EnsureConnected(alice, bob)
|
|
||||||
ht.EnsureConnected(bob, carol)
|
|
||||||
ht.EnsureConnected(carol, dave)
|
|
||||||
ht.EnsureConnected(dave, eve)
|
|
||||||
|
|
||||||
ht.FundCoins(btcutil.SatoshiPerBitcoin, carol)
|
|
||||||
ht.FundCoins(btcutil.SatoshiPerBitcoin, dave)
|
|
||||||
// Open and wait for channels.
|
|
||||||
const chanAmt = btcutil.Amount(300000)
|
const chanAmt = btcutil.Amount(300000)
|
||||||
p := lntest.OpenChannelParams{Amt: chanAmt}
|
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},
|
|
||||||
{Local: dave, Remote: eve, Param: p},
|
|
||||||
}
|
|
||||||
resp := ht.OpenMultiChannelsAsync(reqs)
|
|
||||||
_, cpBC, cpCD, cpDE := resp[0], resp[1], resp[2], resp[3]
|
|
||||||
|
|
||||||
// Make sure Alice is aware of Bob=>Carol=>Dave=>Eve channels.
|
_, nodes := ht.CreateSimpleNetwork(cfgs, p)
|
||||||
ht.AssertChannelInGraph(alice, cpBC)
|
alice, bob, carol, dave, eve := nodes[0], nodes[1], nodes[2], nodes[3],
|
||||||
ht.AssertChannelInGraph(alice, cpCD)
|
nodes[4]
|
||||||
ht.AssertChannelInGraph(alice, cpDE)
|
|
||||||
|
|
||||||
bobIntercept, cancelBob := bob.RPC.HtlcInterceptor()
|
bobIntercept, cancelBob := bob.RPC.HtlcInterceptor()
|
||||||
defer cancelBob()
|
defer cancelBob()
|
||||||
|
@@ -42,23 +42,24 @@ type interceptorTestCase struct {
|
|||||||
// testForwardInterceptorDedupHtlc tests that upon reconnection, duplicate
|
// testForwardInterceptorDedupHtlc tests that upon reconnection, duplicate
|
||||||
// HTLCs aren't re-notified using the HTLC interceptor API.
|
// HTLCs aren't re-notified using the HTLC interceptor API.
|
||||||
func testForwardInterceptorDedupHtlc(ht *lntest.HarnessTest) {
|
func testForwardInterceptorDedupHtlc(ht *lntest.HarnessTest) {
|
||||||
// Initialize the test context with 3 connected nodes.
|
|
||||||
ts := newInterceptorTestScenario(ht)
|
|
||||||
|
|
||||||
alice, bob, carol := ts.alice, ts.bob, ts.carol
|
|
||||||
|
|
||||||
// Open and wait for channels.
|
|
||||||
const chanAmt = btcutil.Amount(300000)
|
const chanAmt = btcutil.Amount(300000)
|
||||||
p := lntest.OpenChannelParams{Amt: chanAmt}
|
p := lntest.OpenChannelParams{Amt: chanAmt}
|
||||||
reqs := []*lntest.OpenChannelRequest{
|
|
||||||
{Local: alice, Remote: bob, Param: p},
|
|
||||||
{Local: bob, Remote: carol, Param: p},
|
|
||||||
}
|
|
||||||
resp := ht.OpenMultiChannelsAsync(reqs)
|
|
||||||
cpAB, cpBC := resp[0], resp[1]
|
|
||||||
|
|
||||||
// Make sure Alice is aware of channel Bob=>Carol.
|
// Initialize the test context with 3 connected nodes.
|
||||||
ht.AssertChannelInGraph(alice, cpBC)
|
cfgs := [][]string{nil, nil, nil}
|
||||||
|
|
||||||
|
// Open and wait for channels.
|
||||||
|
chanPoints, nodes := ht.CreateSimpleNetwork(cfgs, p)
|
||||||
|
alice, bob, carol := nodes[0], nodes[1], nodes[2]
|
||||||
|
cpAB := chanPoints[0]
|
||||||
|
|
||||||
|
// Init the scenario.
|
||||||
|
ts := &interceptorTestScenario{
|
||||||
|
ht: ht,
|
||||||
|
alice: alice,
|
||||||
|
bob: bob,
|
||||||
|
carol: carol,
|
||||||
|
}
|
||||||
|
|
||||||
// Connect the interceptor.
|
// Connect the interceptor.
|
||||||
interceptor, cancelInterceptor := bob.RPC.HtlcInterceptor()
|
interceptor, cancelInterceptor := bob.RPC.HtlcInterceptor()
|
||||||
@@ -190,22 +191,24 @@ func testForwardInterceptorDedupHtlc(ht *lntest.HarnessTest) {
|
|||||||
// 4. When Interceptor disconnects it resumes all held htlcs, which result in
|
// 4. When Interceptor disconnects it resumes all held htlcs, which result in
|
||||||
// valid payment (invoice is settled).
|
// valid payment (invoice is settled).
|
||||||
func testForwardInterceptorBasic(ht *lntest.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)
|
const chanAmt = btcutil.Amount(300000)
|
||||||
p := lntest.OpenChannelParams{Amt: chanAmt}
|
p := lntest.OpenChannelParams{Amt: chanAmt}
|
||||||
reqs := []*lntest.OpenChannelRequest{
|
|
||||||
{Local: alice, Remote: bob, Param: p},
|
|
||||||
{Local: bob, Remote: carol, Param: p},
|
|
||||||
}
|
|
||||||
resp := ht.OpenMultiChannelsAsync(reqs)
|
|
||||||
cpAB, cpBC := resp[0], resp[1]
|
|
||||||
|
|
||||||
// Make sure Alice is aware of channel Bob=>Carol.
|
// Initialize the test context with 3 connected nodes.
|
||||||
ht.AssertChannelInGraph(alice, cpBC)
|
cfgs := [][]string{nil, nil, nil}
|
||||||
|
|
||||||
|
// Open and wait for channels.
|
||||||
|
chanPoints, nodes := ht.CreateSimpleNetwork(cfgs, p)
|
||||||
|
alice, bob, carol := nodes[0], nodes[1], nodes[2]
|
||||||
|
cpAB := chanPoints[0]
|
||||||
|
|
||||||
|
// Init the scenario.
|
||||||
|
ts := &interceptorTestScenario{
|
||||||
|
ht: ht,
|
||||||
|
alice: alice,
|
||||||
|
bob: bob,
|
||||||
|
carol: carol,
|
||||||
|
}
|
||||||
|
|
||||||
// Connect the interceptor.
|
// Connect the interceptor.
|
||||||
interceptor, cancelInterceptor := bob.RPC.HtlcInterceptor()
|
interceptor, cancelInterceptor := bob.RPC.HtlcInterceptor()
|
||||||
@@ -346,23 +349,23 @@ func testForwardInterceptorBasic(ht *lntest.HarnessTest) {
|
|||||||
// testForwardInterceptorModifiedHtlc tests that the interceptor can modify the
|
// testForwardInterceptorModifiedHtlc tests that the interceptor can modify the
|
||||||
// amount and custom records of an intercepted HTLC and resume it.
|
// amount and custom records of an intercepted HTLC and resume it.
|
||||||
func testForwardInterceptorModifiedHtlc(ht *lntest.HarnessTest) {
|
func testForwardInterceptorModifiedHtlc(ht *lntest.HarnessTest) {
|
||||||
// Initialize the test context with 3 connected nodes.
|
|
||||||
ts := newInterceptorTestScenario(ht)
|
|
||||||
|
|
||||||
alice, bob, carol := ts.alice, ts.bob, ts.carol
|
|
||||||
|
|
||||||
// Open and wait for channels.
|
|
||||||
const chanAmt = btcutil.Amount(300000)
|
const chanAmt = btcutil.Amount(300000)
|
||||||
p := lntest.OpenChannelParams{Amt: chanAmt}
|
p := lntest.OpenChannelParams{Amt: chanAmt}
|
||||||
reqs := []*lntest.OpenChannelRequest{
|
|
||||||
{Local: alice, Remote: bob, Param: p},
|
|
||||||
{Local: bob, Remote: carol, Param: p},
|
|
||||||
}
|
|
||||||
resp := ht.OpenMultiChannelsAsync(reqs)
|
|
||||||
cpBC := resp[1]
|
|
||||||
|
|
||||||
// Make sure Alice is aware of channel Bob=>Carol.
|
// Initialize the test context with 3 connected nodes.
|
||||||
ht.AssertChannelInGraph(alice, cpBC)
|
cfgs := [][]string{nil, nil, nil}
|
||||||
|
|
||||||
|
// Open and wait for channels.
|
||||||
|
_, nodes := ht.CreateSimpleNetwork(cfgs, p)
|
||||||
|
alice, bob, carol := nodes[0], nodes[1], nodes[2]
|
||||||
|
|
||||||
|
// Init the scenario.
|
||||||
|
ts := &interceptorTestScenario{
|
||||||
|
ht: ht,
|
||||||
|
alice: alice,
|
||||||
|
bob: bob,
|
||||||
|
carol: carol,
|
||||||
|
}
|
||||||
|
|
||||||
// Connect an interceptor to Bob's node.
|
// Connect an interceptor to Bob's node.
|
||||||
bobInterceptor, cancelBobInterceptor := bob.RPC.HtlcInterceptor()
|
bobInterceptor, cancelBobInterceptor := bob.RPC.HtlcInterceptor()
|
||||||
@@ -449,24 +452,15 @@ func testForwardInterceptorModifiedHtlc(ht *lntest.HarnessTest) {
|
|||||||
// wire custom records provided by the sender of a payment as part of the
|
// wire custom records provided by the sender of a payment as part of the
|
||||||
// update_add_htlc message.
|
// update_add_htlc message.
|
||||||
func testForwardInterceptorWireRecords(ht *lntest.HarnessTest) {
|
func testForwardInterceptorWireRecords(ht *lntest.HarnessTest) {
|
||||||
// Initialize the test context with 3 connected nodes.
|
|
||||||
ts := newInterceptorTestScenario(ht)
|
|
||||||
|
|
||||||
alice, bob, carol, dave := ts.alice, ts.bob, ts.carol, ts.dave
|
|
||||||
|
|
||||||
// Open and wait for channels.
|
|
||||||
const chanAmt = btcutil.Amount(300000)
|
const chanAmt = btcutil.Amount(300000)
|
||||||
p := lntest.OpenChannelParams{Amt: chanAmt}
|
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},
|
|
||||||
}
|
|
||||||
resp := ht.OpenMultiChannelsAsync(reqs)
|
|
||||||
cpBC := resp[1]
|
|
||||||
|
|
||||||
// Make sure Alice is aware of channel Bob=>Carol.
|
// Initialize the test context with 4 connected nodes.
|
||||||
ht.AssertChannelInGraph(alice, cpBC)
|
cfgs := [][]string{nil, nil, nil, nil}
|
||||||
|
|
||||||
|
// Open and wait for channels.
|
||||||
|
_, nodes := ht.CreateSimpleNetwork(cfgs, p)
|
||||||
|
alice, bob, carol, dave := nodes[0], nodes[1], nodes[2], nodes[3]
|
||||||
|
|
||||||
// Connect an interceptor to Bob's node.
|
// Connect an interceptor to Bob's node.
|
||||||
bobInterceptor, cancelBobInterceptor := bob.RPC.HtlcInterceptor()
|
bobInterceptor, cancelBobInterceptor := bob.RPC.HtlcInterceptor()
|
||||||
@@ -574,25 +568,15 @@ func testForwardInterceptorWireRecords(ht *lntest.HarnessTest) {
|
|||||||
// update_add_htlc message and that those records are persisted correctly and
|
// update_add_htlc message and that those records are persisted correctly and
|
||||||
// re-sent on node restart.
|
// re-sent on node restart.
|
||||||
func testForwardInterceptorRestart(ht *lntest.HarnessTest) {
|
func testForwardInterceptorRestart(ht *lntest.HarnessTest) {
|
||||||
// Initialize the test context with 3 connected nodes.
|
|
||||||
ts := newInterceptorTestScenario(ht)
|
|
||||||
|
|
||||||
alice, bob, carol, dave := ts.alice, ts.bob, ts.carol, ts.dave
|
|
||||||
|
|
||||||
// Open and wait for channels.
|
|
||||||
const chanAmt = btcutil.Amount(300000)
|
const chanAmt = btcutil.Amount(300000)
|
||||||
p := lntest.OpenChannelParams{Amt: chanAmt}
|
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},
|
|
||||||
}
|
|
||||||
resp := ht.OpenMultiChannelsAsync(reqs)
|
|
||||||
cpBC, cpCD := resp[1], resp[2]
|
|
||||||
|
|
||||||
// Make sure Alice is aware of channels Bob=>Carol and Carol=>Dave.
|
// Initialize the test context with 4 connected nodes.
|
||||||
ht.AssertChannelInGraph(alice, cpBC)
|
cfgs := [][]string{nil, nil, nil, nil}
|
||||||
ht.AssertChannelInGraph(alice, cpCD)
|
|
||||||
|
// Open and wait for channels.
|
||||||
|
_, nodes := ht.CreateSimpleNetwork(cfgs, p)
|
||||||
|
alice, bob, carol, dave := nodes[0], nodes[1], nodes[2], nodes[3]
|
||||||
|
|
||||||
// Connect an interceptor to Bob's node.
|
// Connect an interceptor to Bob's node.
|
||||||
bobInterceptor, cancelBobInterceptor := bob.RPC.HtlcInterceptor()
|
bobInterceptor, cancelBobInterceptor := bob.RPC.HtlcInterceptor()
|
||||||
@@ -730,39 +714,8 @@ func testForwardInterceptorRestart(ht *lntest.HarnessTest) {
|
|||||||
// interceptorTestScenario is a helper struct to hold the test context and
|
// interceptorTestScenario is a helper struct to hold the test context and
|
||||||
// provide the needed functionality.
|
// provide the needed functionality.
|
||||||
type interceptorTestScenario struct {
|
type interceptorTestScenario struct {
|
||||||
ht *lntest.HarnessTest
|
ht *lntest.HarnessTest
|
||||||
alice, bob, carol, dave *node.HarnessNode
|
alice, bob, carol *node.HarnessNode
|
||||||
}
|
|
||||||
|
|
||||||
// newInterceptorTestScenario initializes a new test scenario with three nodes
|
|
||||||
// and connects them to have the following topology,
|
|
||||||
//
|
|
||||||
// Alice --> Bob --> Carol --> Dave
|
|
||||||
//
|
|
||||||
// Among them, Alice and Bob are standby nodes and Carol is a new node.
|
|
||||||
func newInterceptorTestScenario(
|
|
||||||
ht *lntest.HarnessTest) *interceptorTestScenario {
|
|
||||||
|
|
||||||
alice := ht.NewNodeWithCoins("Alice", nil)
|
|
||||||
bob := ht.NewNodeWithCoins("bob", nil)
|
|
||||||
|
|
||||||
carol := ht.NewNode("carol", nil)
|
|
||||||
dave := ht.NewNode("dave", nil)
|
|
||||||
|
|
||||||
ht.EnsureConnected(alice, bob)
|
|
||||||
ht.EnsureConnected(bob, carol)
|
|
||||||
ht.EnsureConnected(carol, dave)
|
|
||||||
|
|
||||||
// So that carol can open channels.
|
|
||||||
ht.FundCoins(btcutil.SatoshiPerBitcoin, carol)
|
|
||||||
|
|
||||||
return &interceptorTestScenario{
|
|
||||||
ht: ht,
|
|
||||||
alice: alice,
|
|
||||||
bob: bob,
|
|
||||||
carol: carol,
|
|
||||||
dave: dave,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// prepareTestCases prepares 4 tests:
|
// prepareTestCases prepares 4 tests:
|
||||||
|
@@ -1070,23 +1070,16 @@ func assertChannelState(ht *lntest.HarnessTest, hn *node.HarnessNode,
|
|||||||
// 5.) Alice observes a failed OR succeeded payment with failure reason
|
// 5.) Alice observes a failed OR succeeded payment with failure reason
|
||||||
// FAILURE_REASON_CANCELED which suppresses further payment attempts.
|
// FAILURE_REASON_CANCELED which suppresses further payment attempts.
|
||||||
func testPaymentFailureReasonCanceled(ht *lntest.HarnessTest) {
|
func testPaymentFailureReasonCanceled(ht *lntest.HarnessTest) {
|
||||||
// Initialize the test context with 3 connected nodes.
|
|
||||||
ts := newInterceptorTestScenario(ht)
|
|
||||||
|
|
||||||
alice, bob, carol := ts.alice, ts.bob, ts.carol
|
|
||||||
|
|
||||||
// Open and wait for channels.
|
|
||||||
const chanAmt = btcutil.Amount(300000)
|
const chanAmt = btcutil.Amount(300000)
|
||||||
p := lntest.OpenChannelParams{Amt: chanAmt}
|
p := lntest.OpenChannelParams{Amt: chanAmt}
|
||||||
reqs := []*lntest.OpenChannelRequest{
|
|
||||||
{Local: alice, Remote: bob, Param: p},
|
|
||||||
{Local: bob, Remote: carol, Param: p},
|
|
||||||
}
|
|
||||||
resp := ht.OpenMultiChannelsAsync(reqs)
|
|
||||||
cpAB, cpBC := resp[0], resp[1]
|
|
||||||
|
|
||||||
// Make sure Alice is aware of channel Bob=>Carol.
|
// Initialize the test context with 3 connected nodes.
|
||||||
ht.AssertChannelInGraph(alice, cpBC)
|
cfgs := [][]string{nil, nil, nil}
|
||||||
|
|
||||||
|
// Open and wait for channels.
|
||||||
|
chanPoints, nodes := ht.CreateSimpleNetwork(cfgs, p)
|
||||||
|
alice, bob, carol := nodes[0], nodes[1], nodes[2]
|
||||||
|
cpAB := chanPoints[0]
|
||||||
|
|
||||||
// Connect the interceptor.
|
// Connect the interceptor.
|
||||||
interceptor, cancelInterceptor := bob.RPC.HtlcInterceptor()
|
interceptor, cancelInterceptor := bob.RPC.HtlcInterceptor()
|
||||||
@@ -1096,7 +1089,8 @@ func testPaymentFailureReasonCanceled(ht *lntest.HarnessTest) {
|
|||||||
// htlc even though the payment context was canceled before invoice
|
// htlc even though the payment context was canceled before invoice
|
||||||
// settlement.
|
// settlement.
|
||||||
sendPaymentInterceptAndCancel(
|
sendPaymentInterceptAndCancel(
|
||||||
ht, ts, cpAB, routerrpc.ResolveHoldForwardAction_RESUME,
|
ht, alice, bob, carol, cpAB,
|
||||||
|
routerrpc.ResolveHoldForwardAction_RESUME,
|
||||||
lnrpc.Payment_SUCCEEDED, interceptor,
|
lnrpc.Payment_SUCCEEDED, interceptor,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1106,20 +1100,18 @@ func testPaymentFailureReasonCanceled(ht *lntest.HarnessTest) {
|
|||||||
// Note that we'd have to reset Alice's mission control if we tested the
|
// Note that we'd have to reset Alice's mission control if we tested the
|
||||||
// htlc fail case before the htlc resume case.
|
// htlc fail case before the htlc resume case.
|
||||||
sendPaymentInterceptAndCancel(
|
sendPaymentInterceptAndCancel(
|
||||||
ht, ts, cpAB, routerrpc.ResolveHoldForwardAction_FAIL,
|
ht, alice, bob, carol, cpAB,
|
||||||
|
routerrpc.ResolveHoldForwardAction_FAIL,
|
||||||
lnrpc.Payment_FAILED, interceptor,
|
lnrpc.Payment_FAILED, interceptor,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func sendPaymentInterceptAndCancel(ht *lntest.HarnessTest,
|
func sendPaymentInterceptAndCancel(ht *lntest.HarnessTest,
|
||||||
ts *interceptorTestScenario, cpAB *lnrpc.ChannelPoint,
|
alice, bob, carol *node.HarnessNode, cpAB *lnrpc.ChannelPoint,
|
||||||
interceptorAction routerrpc.ResolveHoldForwardAction,
|
interceptorAction routerrpc.ResolveHoldForwardAction,
|
||||||
expectedPaymentStatus lnrpc.Payment_PaymentStatus,
|
expectedPaymentStatus lnrpc.Payment_PaymentStatus,
|
||||||
interceptor rpc.InterceptorClient) {
|
interceptor rpc.InterceptorClient) {
|
||||||
|
|
||||||
// Prepare the test cases.
|
|
||||||
alice, bob, carol := ts.alice, ts.bob, ts.carol
|
|
||||||
|
|
||||||
// Prepare the test cases.
|
// Prepare the test cases.
|
||||||
addResponse := carol.RPC.AddInvoice(&lnrpc.Invoice{
|
addResponse := carol.RPC.AddInvoice(&lnrpc.Invoice{
|
||||||
ValueMsat: 1000,
|
ValueMsat: 1000,
|
||||||
|
@@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/lightningnetwork/lnd/lnrpc/devrpc"
|
"github.com/lightningnetwork/lnd/lnrpc/devrpc"
|
||||||
"github.com/lightningnetwork/lnd/lnrpc/routerrpc"
|
"github.com/lightningnetwork/lnd/lnrpc/routerrpc"
|
||||||
"github.com/lightningnetwork/lnd/lntest"
|
"github.com/lightningnetwork/lnd/lntest"
|
||||||
|
"github.com/lightningnetwork/lnd/lntest/node"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -16,12 +17,14 @@ import (
|
|||||||
// NOTE FOR REVIEW: this could be improved by blasting the channel with HTLC
|
// NOTE FOR REVIEW: this could be improved by blasting the channel with HTLC
|
||||||
// traffic on both sides to increase the surface area of the change under test.
|
// traffic on both sides to increase the surface area of the change under test.
|
||||||
func testQuiescence(ht *lntest.HarnessTest) {
|
func testQuiescence(ht *lntest.HarnessTest) {
|
||||||
alice := ht.NewNodeWithCoins("Alice", nil)
|
cfg := node.CfgAnchor
|
||||||
bob := ht.NewNode("Bob", nil)
|
chanPoints, nodes := ht.CreateSimpleNetwork(
|
||||||
|
[][]string{cfg, cfg}, lntest.OpenChannelParams{
|
||||||
|
Amt: btcutil.Amount(1000000),
|
||||||
|
})
|
||||||
|
|
||||||
chanPoint := ht.OpenChannel(bob, alice, lntest.OpenChannelParams{
|
alice, bob := nodes[0], nodes[1]
|
||||||
Amt: btcutil.Amount(1000000),
|
chanPoint := chanPoints[0]
|
||||||
})
|
|
||||||
|
|
||||||
res := alice.RPC.Quiesce(&devrpc.QuiescenceRequest{
|
res := alice.RPC.Quiesce(&devrpc.QuiescenceRequest{
|
||||||
ChanId: chanPoint,
|
ChanId: chanPoint,
|
||||||
|
Reference in New Issue
Block a user