mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-19 10:37:23 +01:00
itest: refactor testZeroConfChannelOpen
This commit is contained in:
@@ -417,4 +417,8 @@ var allTestCasesTemp = []*lntemp.TestCase{
|
|||||||
Name: "forward interceptor",
|
Name: "forward interceptor",
|
||||||
TestFunc: testForwardInterceptorBasic,
|
TestFunc: testForwardInterceptorBasic,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "zero conf channel open",
|
||||||
|
TestFunc: testZeroConfChannelOpen,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,10 +56,6 @@ var allTestCases = []*testCase{
|
|||||||
name: "taproot",
|
name: "taproot",
|
||||||
test: testTaproot,
|
test: testTaproot,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "zero conf channel open",
|
|
||||||
test: testZeroConfChannelOpen,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "option scid alias",
|
name: "option scid alias",
|
||||||
test: testOptionScidAlias,
|
test: testOptionScidAlias,
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ import (
|
|||||||
"github.com/lightningnetwork/lnd/chainreg"
|
"github.com/lightningnetwork/lnd/chainreg"
|
||||||
"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/lntemp"
|
||||||
|
"github.com/lightningnetwork/lnd/lntemp/node"
|
||||||
|
"github.com/lightningnetwork/lnd/lntemp/rpc"
|
||||||
"github.com/lightningnetwork/lnd/lntest"
|
"github.com/lightningnetwork/lnd/lntest"
|
||||||
"github.com/lightningnetwork/lnd/lntest/wait"
|
"github.com/lightningnetwork/lnd/lntest/wait"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
@@ -18,9 +21,7 @@ import (
|
|||||||
|
|
||||||
// testZeroConfChannelOpen tests that opening a zero-conf channel works and
|
// testZeroConfChannelOpen tests that opening a zero-conf channel works and
|
||||||
// sending payments also works.
|
// sending payments also works.
|
||||||
func testZeroConfChannelOpen(net *lntest.NetworkHarness, t *harnessTest) {
|
func testZeroConfChannelOpen(ht *lntemp.HarnessTest) {
|
||||||
ctxb := context.Background()
|
|
||||||
|
|
||||||
// Since option-scid-alias is opt-in, the provided harness nodes will
|
// Since option-scid-alias is opt-in, the provided harness nodes will
|
||||||
// not have the feature bit set. Also need to set anchors as those are
|
// not have the feature bit set. Also need to set anchors as those are
|
||||||
// default-off in itests.
|
// default-off in itests.
|
||||||
@@ -30,93 +31,65 @@ func testZeroConfChannelOpen(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
"--protocol.anchors",
|
"--protocol.anchors",
|
||||||
}
|
}
|
||||||
|
|
||||||
carol := net.NewNode(t.t, "Carol", scidAliasArgs)
|
bob := ht.Bob
|
||||||
defer shutdownAndAssert(net, t, carol)
|
carol := ht.NewNode("Carol", scidAliasArgs)
|
||||||
|
ht.EnsureConnected(bob, carol)
|
||||||
|
|
||||||
// We'll open a regular public channel between Bob and Carol here.
|
// We'll open a regular public channel between Bob and Carol here.
|
||||||
net.EnsureConnected(t.t, net.Bob, carol)
|
|
||||||
|
|
||||||
chanAmt := btcutil.Amount(1_000_000)
|
chanAmt := btcutil.Amount(1_000_000)
|
||||||
|
p := lntemp.OpenChannelParams{
|
||||||
fundingPoint := openChannelAndAssert(
|
|
||||||
t, net, net.Bob, carol,
|
|
||||||
lntest.OpenChannelParams{
|
|
||||||
Amt: chanAmt,
|
Amt: chanAmt,
|
||||||
},
|
}
|
||||||
)
|
chanPoint := ht.OpenChannel(bob, carol, p)
|
||||||
|
|
||||||
// Wait for both Bob and Carol to view the channel as active.
|
|
||||||
err := net.Bob.WaitForNetworkChannelOpen(fundingPoint)
|
|
||||||
require.NoError(t.t, err, "bob didn't report channel")
|
|
||||||
err = carol.WaitForNetworkChannelOpen(fundingPoint)
|
|
||||||
require.NoError(t.t, err, "carol didn't report channel")
|
|
||||||
|
|
||||||
// Spin-up Dave so Carol can open a zero-conf channel to him.
|
// Spin-up Dave so Carol can open a zero-conf channel to him.
|
||||||
dave := net.NewNode(t.t, "Dave", scidAliasArgs)
|
dave := ht.NewNode("Dave", scidAliasArgs)
|
||||||
defer shutdownAndAssert(net, t, dave)
|
|
||||||
|
|
||||||
// We'll give Carol some coins in order to fund the channel.
|
// We'll give Carol some coins in order to fund the channel.
|
||||||
net.SendCoins(t.t, btcutil.SatoshiPerBitcoin, carol)
|
ht.FundCoins(btcutil.SatoshiPerBitcoin, carol)
|
||||||
|
|
||||||
// Ensure that both Carol and Dave are connected.
|
// Ensure that both Carol and Dave are connected.
|
||||||
net.EnsureConnected(t.t, carol, dave)
|
ht.EnsureConnected(carol, dave)
|
||||||
|
|
||||||
// Setup a ChannelAcceptor for Dave.
|
// Setup a ChannelAcceptor for Dave.
|
||||||
ctxc, cancel := context.WithCancel(ctxb)
|
acceptStream, cancel := dave.RPC.ChannelAcceptor()
|
||||||
acceptStream, err := dave.ChannelAcceptor(ctxc)
|
go acceptChannel(ht.T, true, acceptStream)
|
||||||
require.NoError(t.t, err)
|
|
||||||
go acceptChannel(t.t, true, acceptStream)
|
|
||||||
|
|
||||||
// Open a private zero-conf anchors channel of 1M satoshis.
|
// Open a private zero-conf anchors channel of 1M satoshis.
|
||||||
params := lntest.OpenChannelParams{
|
params := lntemp.OpenChannelParams{
|
||||||
Amt: chanAmt,
|
Amt: chanAmt,
|
||||||
Private: true,
|
Private: true,
|
||||||
CommitmentType: lnrpc.CommitmentType_ANCHORS,
|
CommitmentType: lnrpc.CommitmentType_ANCHORS,
|
||||||
ZeroConf: true,
|
ZeroConf: true,
|
||||||
}
|
}
|
||||||
chanOpenUpdate := openChannelStream(t, net, carol, dave, params)
|
stream := ht.OpenChannelAssertStream(carol, dave, params)
|
||||||
|
|
||||||
// Remove the ChannelAcceptor.
|
// Remove the ChannelAcceptor.
|
||||||
cancel()
|
cancel()
|
||||||
|
|
||||||
// We should receive the OpenStatusUpdate_ChanOpen update without
|
// We should receive the OpenStatusUpdate_ChanOpen update without
|
||||||
// having to mine any blocks.
|
// having to mine any blocks.
|
||||||
fundingPoint2, err := net.WaitForChannelOpen(chanOpenUpdate)
|
fundingPoint2 := ht.WaitForChannelOpenEvent(stream)
|
||||||
require.NoError(t.t, err, "error while waiting for channel open")
|
|
||||||
|
|
||||||
err = carol.WaitForNetworkChannelOpen(fundingPoint2)
|
ht.AssertTopologyChannelOpen(carol, fundingPoint2)
|
||||||
require.NoError(t.t, err, "carol didn't report channel")
|
ht.AssertTopologyChannelOpen(dave, fundingPoint2)
|
||||||
err = dave.WaitForNetworkChannelOpen(fundingPoint2)
|
|
||||||
require.NoError(t.t, err, "dave didn't report channel")
|
|
||||||
|
|
||||||
// Attempt to send a 10K satoshi payment from Carol to Dave.
|
// Attempt to send a 10K satoshi payment from Carol to Dave.
|
||||||
daveInvoiceParams := &lnrpc.Invoice{
|
daveInvoiceParams := &lnrpc.Invoice{
|
||||||
Value: int64(10_000),
|
Value: int64(10_000),
|
||||||
Private: true,
|
Private: true,
|
||||||
}
|
}
|
||||||
daveInvoiceResp, err := dave.AddInvoice(
|
daveInvoiceResp := dave.RPC.AddInvoice(daveInvoiceParams)
|
||||||
ctxb, daveInvoiceParams,
|
ht.CompletePaymentRequests(
|
||||||
)
|
carol, []string{daveInvoiceResp.PaymentRequest},
|
||||||
require.NoError(t.t, err, "unable to add invoice")
|
|
||||||
_ = sendAndAssertSuccess(
|
|
||||||
t, carol, &routerrpc.SendPaymentRequest{
|
|
||||||
PaymentRequest: daveInvoiceResp.PaymentRequest,
|
|
||||||
TimeoutSeconds: 60,
|
|
||||||
FeeLimitMsat: noFeeLimitMsat,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Now attempt to send a multi-hop payment from Bob to Dave. This tests
|
// Now attempt to send a multi-hop payment from Bob to Dave. This tests
|
||||||
// that Dave issues an invoice with an alias SCID that Carol knows and
|
// that Dave issues an invoice with an alias SCID that Carol knows and
|
||||||
// uses to forward to Dave.
|
// uses to forward to Dave.
|
||||||
daveInvoiceResp2, err := dave.AddInvoice(ctxb, daveInvoiceParams)
|
daveInvoiceResp2 := dave.RPC.AddInvoice(daveInvoiceParams)
|
||||||
require.NoError(t.t, err, "unable to add invoice")
|
ht.CompletePaymentRequests(
|
||||||
_ = sendAndAssertSuccess(
|
bob, []string{daveInvoiceResp2.PaymentRequest},
|
||||||
t, net.Bob, &routerrpc.SendPaymentRequest{
|
|
||||||
PaymentRequest: daveInvoiceResp2.PaymentRequest,
|
|
||||||
TimeoutSeconds: 60,
|
|
||||||
FeeLimitMsat: noFeeLimitMsat,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Check that Dave has a zero-conf alias SCID in the graph.
|
// Check that Dave has a zero-conf alias SCID in the graph.
|
||||||
@@ -124,121 +97,94 @@ func testZeroConfChannelOpen(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
IncludeUnannounced: true,
|
IncludeUnannounced: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
err = waitForZeroConfGraphChange(ctxb, dave, descReq, true)
|
err := waitForZeroConfGraphChange(dave, descReq, true)
|
||||||
require.NoError(t.t, err)
|
require.NoError(ht, err)
|
||||||
|
|
||||||
// We'll now confirm the zero-conf channel between Carol and Dave and
|
// We'll now confirm the zero-conf channel between Carol and Dave and
|
||||||
// assert that sending is still possible.
|
// assert that sending is still possible.
|
||||||
block := mineBlocks(t, net, 6, 1)[0]
|
block := ht.MineBlocksAndAssertNumTxes(6, 1)[0]
|
||||||
|
|
||||||
// Dave should still have the alias edge in his db.
|
// Dave should still have the alias edge in his db.
|
||||||
err = waitForZeroConfGraphChange(ctxb, dave, descReq, true)
|
err = waitForZeroConfGraphChange(dave, descReq, true)
|
||||||
require.NoError(t.t, err)
|
require.NoError(ht, err)
|
||||||
|
|
||||||
fundingTxID, err := lnrpc.GetChanPointFundingTxid(fundingPoint2)
|
fundingTxID := ht.GetChanPointFundingTxid(fundingPoint2)
|
||||||
require.NoError(t.t, err, "unable to get txid")
|
|
||||||
|
|
||||||
assertTxInBlock(t, block, fundingTxID)
|
ht.Miner.AssertTxInBlock(block, fundingTxID)
|
||||||
|
|
||||||
daveInvoiceResp3, err := dave.AddInvoice(
|
daveInvoiceResp3 := dave.RPC.AddInvoice(daveInvoiceParams)
|
||||||
ctxb, daveInvoiceParams,
|
ht.CompletePaymentRequests(
|
||||||
)
|
bob, []string{daveInvoiceResp3.PaymentRequest},
|
||||||
require.NoError(t.t, err, "unable to add invoice")
|
|
||||||
_ = sendAndAssertSuccess(
|
|
||||||
t, net.Bob, &routerrpc.SendPaymentRequest{
|
|
||||||
PaymentRequest: daveInvoiceResp3.PaymentRequest,
|
|
||||||
TimeoutSeconds: 60,
|
|
||||||
FeeLimitMsat: noFeeLimitMsat,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Eve will now initiate a zero-conf channel with Carol. This tests
|
// Eve will now initiate a zero-conf channel with Carol. This tests
|
||||||
// that the ChannelUpdates sent are correct since they will be
|
// that the ChannelUpdates sent are correct since they will be
|
||||||
// referring to different alias SCIDs.
|
// referring to different alias SCIDs.
|
||||||
eve := net.NewNode(t.t, "Eve", scidAliasArgs)
|
eve := ht.NewNode("Eve", scidAliasArgs)
|
||||||
defer shutdownAndAssert(net, t, eve)
|
ht.EnsureConnected(eve, carol)
|
||||||
|
|
||||||
net.EnsureConnected(t.t, eve, carol)
|
|
||||||
|
|
||||||
// Give Eve some coins to fund the channel.
|
// Give Eve some coins to fund the channel.
|
||||||
net.SendCoins(t.t, btcutil.SatoshiPerBitcoin, eve)
|
ht.FundCoins(btcutil.SatoshiPerBitcoin, eve)
|
||||||
|
|
||||||
// Setup a ChannelAcceptor.
|
// Setup a ChannelAcceptor.
|
||||||
ctxc, cancel = context.WithCancel(ctxb)
|
acceptStream, cancel = carol.RPC.ChannelAcceptor()
|
||||||
acceptStream, err = carol.ChannelAcceptor(ctxc)
|
go acceptChannel(ht.T, true, acceptStream)
|
||||||
require.NoError(t.t, err)
|
|
||||||
go acceptChannel(t.t, true, acceptStream)
|
|
||||||
|
|
||||||
// We'll open a public zero-conf anchors channel of 1M satoshis.
|
// We'll open a public zero-conf anchors channel of 1M satoshis.
|
||||||
params.Private = false
|
params.Private = false
|
||||||
chanOpenUpdate2 := openChannelStream(t, net, eve, carol, params)
|
stream = ht.OpenChannelAssertStream(eve, carol, params)
|
||||||
|
|
||||||
// Remove the ChannelAcceptor.
|
// Remove the ChannelAcceptor.
|
||||||
cancel()
|
cancel()
|
||||||
|
|
||||||
// Wait to receive the OpenStatusUpdate_ChanOpen update.
|
// Wait to receive the OpenStatusUpdate_ChanOpen update.
|
||||||
fundingPoint3, err := net.WaitForChannelOpen(chanOpenUpdate2)
|
fundingPoint3 := ht.WaitForChannelOpenEvent(stream)
|
||||||
require.NoError(t.t, err, "error while waiting for channel open")
|
|
||||||
|
|
||||||
err = eve.WaitForNetworkChannelOpen(fundingPoint3)
|
ht.AssertTopologyChannelOpen(eve, fundingPoint3)
|
||||||
require.NoError(t.t, err, "eve didn't report channel")
|
ht.AssertTopologyChannelOpen(carol, fundingPoint3)
|
||||||
err = carol.WaitForNetworkChannelOpen(fundingPoint3)
|
|
||||||
require.NoError(t.t, err, "carol didn't report channel")
|
|
||||||
|
|
||||||
// Attempt to send a 20K satoshi payment from Eve to Dave.
|
// Attempt to send a 20K satoshi payment from Eve to Dave.
|
||||||
daveInvoiceParams.Value = int64(20_000)
|
daveInvoiceParams.Value = int64(20_000)
|
||||||
daveInvoiceResp4, err := dave.AddInvoice(
|
daveInvoiceResp4 := dave.RPC.AddInvoice(daveInvoiceParams)
|
||||||
ctxb, daveInvoiceParams,
|
ht.CompletePaymentRequests(
|
||||||
)
|
eve, []string{daveInvoiceResp4.PaymentRequest},
|
||||||
require.NoError(t.t, err, "unable to add invoice")
|
|
||||||
_ = sendAndAssertSuccess(
|
|
||||||
t, eve, &routerrpc.SendPaymentRequest{
|
|
||||||
PaymentRequest: daveInvoiceResp4.PaymentRequest,
|
|
||||||
TimeoutSeconds: 60,
|
|
||||||
FeeLimitMsat: noFeeLimitMsat,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Assert that Eve has stored the zero-conf alias in her graph.
|
// Assert that Eve has stored the zero-conf alias in her graph.
|
||||||
err = waitForZeroConfGraphChange(ctxb, eve, descReq, true)
|
err = waitForZeroConfGraphChange(eve, descReq, true)
|
||||||
require.NoError(t.t, err)
|
require.NoError(ht, err, "expected to not receive error")
|
||||||
|
|
||||||
// We'll confirm the zero-conf channel between Eve and Carol and assert
|
// We'll confirm the zero-conf channel between Eve and Carol and assert
|
||||||
// that sending is still possible.
|
// that sending is still possible.
|
||||||
block = mineBlocks(t, net, 6, 1)[0]
|
block = ht.MineBlocksAndAssertNumTxes(6, 1)[0]
|
||||||
|
|
||||||
fundingTxID, err = lnrpc.GetChanPointFundingTxid(fundingPoint3)
|
fundingTxID = ht.GetChanPointFundingTxid(fundingPoint3)
|
||||||
require.NoError(t.t, err, "unable to get txid")
|
ht.Miner.AssertTxInBlock(block, fundingTxID)
|
||||||
|
|
||||||
assertTxInBlock(t, block, fundingTxID)
|
|
||||||
|
|
||||||
// Wait until Eve's ZeroConf channel is replaced by the confirmed SCID
|
// Wait until Eve's ZeroConf channel is replaced by the confirmed SCID
|
||||||
// in her graph.
|
// in her graph.
|
||||||
err = waitForZeroConfGraphChange(ctxb, eve, descReq, false)
|
err = waitForZeroConfGraphChange(eve, descReq, false)
|
||||||
require.NoError(t.t, err, "expected to not receive error")
|
require.NoError(ht, err, "expected to not receive error")
|
||||||
|
|
||||||
// Attempt to send a 6K satoshi payment from Dave to Eve.
|
// Attempt to send a 6K satoshi payment from Dave to Eve.
|
||||||
eveInvoiceParams := &lnrpc.Invoice{
|
eveInvoiceParams := &lnrpc.Invoice{
|
||||||
Value: int64(6_000),
|
Value: int64(6_000),
|
||||||
Private: true,
|
Private: true,
|
||||||
}
|
}
|
||||||
eveInvoiceResp, err := eve.AddInvoice(ctxb, eveInvoiceParams)
|
eveInvoiceResp := eve.RPC.AddInvoice(eveInvoiceParams)
|
||||||
require.NoError(t.t, err, "unable to add invoice")
|
|
||||||
|
|
||||||
// Assert that route hints is empty since the channel is public.
|
// Assert that route hints is empty since the channel is public.
|
||||||
payReq, err := eve.DecodePayReq(ctxb, &lnrpc.PayReqString{
|
payReq := eve.RPC.DecodePayReq(eveInvoiceResp.PaymentRequest)
|
||||||
PayReq: eveInvoiceResp.PaymentRequest,
|
require.Len(ht, payReq.RouteHints, 0)
|
||||||
})
|
|
||||||
require.NoError(t.t, err)
|
|
||||||
require.True(t.t, len(payReq.RouteHints) == 0)
|
|
||||||
|
|
||||||
_ = sendAndAssertSuccess(
|
// Make sure Dave is aware of this channel and send the payment.
|
||||||
t, dave, &routerrpc.SendPaymentRequest{
|
ht.AssertTopologyChannelOpen(dave, fundingPoint3)
|
||||||
PaymentRequest: eveInvoiceResp.PaymentRequest,
|
ht.CompletePaymentRequests(
|
||||||
TimeoutSeconds: 60,
|
dave, []string{eveInvoiceResp.PaymentRequest},
|
||||||
FeeLimitMsat: noFeeLimitMsat,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Close standby node's channels.
|
||||||
|
ht.CloseChannel(bob, chanPoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
// testOptionScidAlias checks that opening an option_scid_alias channel-type
|
// testOptionScidAlias checks that opening an option_scid_alias channel-type
|
||||||
@@ -413,15 +359,11 @@ func optionScidAliasScenario(net *lntest.NetworkHarness, t *harnessTest,
|
|||||||
// the graph after confirmation or not. The expect argument denotes whether the
|
// the graph after confirmation or not. The expect argument denotes whether the
|
||||||
// zero-conf is expected in the graph or not. There should always be at least
|
// zero-conf is expected in the graph or not. There should always be at least
|
||||||
// one channel of the passed HarnessNode, zero-conf or not.
|
// one channel of the passed HarnessNode, zero-conf or not.
|
||||||
func waitForZeroConfGraphChange(ctxb context.Context, n *lntest.HarnessNode,
|
func waitForZeroConfGraphChange(hn *node.HarnessNode,
|
||||||
req *lnrpc.ChannelGraphRequest, expect bool) error {
|
req *lnrpc.ChannelGraphRequest, expect bool) error {
|
||||||
|
|
||||||
return wait.NoError(func() error {
|
return wait.NoError(func() error {
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
graph := hn.RPC.DescribeGraph(req)
|
||||||
graph, err := n.DescribeGraph(ctxt, req)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if expect {
|
if expect {
|
||||||
// If we expect a zero-conf channel, we'll assert that
|
// If we expect a zero-conf channel, we'll assert that
|
||||||
@@ -447,8 +389,8 @@ func waitForZeroConfGraphChange(ctxb context.Context, n *lntest.HarnessNode,
|
|||||||
|
|
||||||
// Check if we are party to the zero-conf
|
// Check if we are party to the zero-conf
|
||||||
// channel.
|
// channel.
|
||||||
if e.Node1Pub == n.PubKeyStr ||
|
if e.Node1Pub == hn.PubKeyStr ||
|
||||||
e.Node2Pub == n.PubKeyStr {
|
e.Node2Pub == hn.PubKeyStr {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -474,8 +416,8 @@ func waitForZeroConfGraphChange(ctxb context.Context, n *lntest.HarnessNode,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If we are part of this channel, exit gracefully.
|
// If we are part of this channel, exit gracefully.
|
||||||
if e.Node1Pub == n.PubKeyStr ||
|
if e.Node1Pub == hn.PubKeyStr ||
|
||||||
e.Node2Pub == n.PubKeyStr {
|
e.Node2Pub == hn.PubKeyStr {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -1068,3 +1010,22 @@ func testOptionScidUpgrade(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// acceptChannel is used to accept a single channel that comes across. This
|
||||||
|
// should be run in a goroutine and is used to test nodes with the zero-conf
|
||||||
|
// feature bit.
|
||||||
|
func acceptChannel(t *testing.T, zeroConf bool, stream rpc.AcceptorClient) {
|
||||||
|
|
||||||
|
t.Helper()
|
||||||
|
|
||||||
|
req, err := stream.Recv()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
resp := &lnrpc.ChannelAcceptResponse{
|
||||||
|
Accept: true,
|
||||||
|
PendingChanId: req.PendingChanId,
|
||||||
|
ZeroConf: zeroConf,
|
||||||
|
}
|
||||||
|
err = stream.Send(resp)
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import (
|
|||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"testing"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/btcsuite/btcd/btcutil"
|
"github.com/btcsuite/btcd/btcutil"
|
||||||
@@ -18,7 +17,6 @@ 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/lntemp"
|
"github.com/lightningnetwork/lnd/lntemp"
|
||||||
"github.com/lightningnetwork/lnd/lntemp/rpc"
|
|
||||||
"github.com/lightningnetwork/lnd/lntest"
|
"github.com/lightningnetwork/lnd/lntest"
|
||||||
"github.com/lightningnetwork/lnd/lntest/wait"
|
"github.com/lightningnetwork/lnd/lntest/wait"
|
||||||
"github.com/lightningnetwork/lnd/lnwallet"
|
"github.com/lightningnetwork/lnd/lnwallet"
|
||||||
@@ -498,21 +496,3 @@ func getOutputIndex(t *harnessTest, miner *lntest.HarnessMiner,
|
|||||||
|
|
||||||
return p2trOutputIndex
|
return p2trOutputIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
// acceptChannel is used to accept a single channel that comes across. This
|
|
||||||
// should be run in a goroutine and is used to test nodes with the zero-conf
|
|
||||||
// feature bit.
|
|
||||||
func acceptChannel(t *testing.T, zeroConf bool, stream rpc.AcceptorClient) {
|
|
||||||
t.Helper()
|
|
||||||
|
|
||||||
req, err := stream.Recv()
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
resp := &lnrpc.ChannelAcceptResponse{
|
|
||||||
Accept: true,
|
|
||||||
PendingChanId: req.PendingChanId,
|
|
||||||
ZeroConf: zeroConf,
|
|
||||||
}
|
|
||||||
err = stream.Send(resp)
|
|
||||||
require.NoError(t, err)
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user