diff --git a/lnd_test.go b/lnd_test.go index 82dd6a6d..ec55e3f0 100644 --- a/lnd_test.go +++ b/lnd_test.go @@ -153,7 +153,7 @@ func openChannelAndAssert(ctx context.Context, t *harnessTest, private bool) *lnrpc.ChannelPoint { chanOpenUpdate, err := net.OpenChannel( - ctx, alice, bob, fundingAmt, pushAmt, private, + ctx, alice, bob, fundingAmt, pushAmt, private, true, ) if err != nil { t.Fatalf("unable to open channel: %v", err) @@ -3694,8 +3694,9 @@ func testPrivateChannels(net *lntest.NetworkHarness, t *harnessTest) { if err := net.ConnectNodes(ctxb, carol, net.Alice); err != nil { t.Fatalf("unable to connect dave to alice: %v", err) } - chanOpenUpdate, err := net.OpenChannel(ctxb, carol, net.Alice, chanAmt, - 0, true) + chanOpenUpdate, err := net.OpenChannel( + ctxb, carol, net.Alice, chanAmt, 0, true, true, + ) if err != nil { t.Fatalf("unable to open channel: %v", err) } @@ -4576,8 +4577,9 @@ func testMaxPendingChannels(net *lntest.NetworkHarness, t *harnessTest) { openStreams := make([]lnrpc.Lightning_OpenChannelClient, maxPendingChannels) for i := 0; i < maxPendingChannels; i++ { ctx, _ = context.WithTimeout(context.Background(), timeout) - stream, err := net.OpenChannel(ctx, net.Alice, carol, amount, - 0, false) + stream, err := net.OpenChannel( + ctx, net.Alice, carol, amount, 0, false, true, + ) if err != nil { t.Fatalf("unable to open channel: %v", err) } @@ -4587,7 +4589,9 @@ func testMaxPendingChannels(net *lntest.NetworkHarness, t *harnessTest) { // Carol exhausted available amount of pending channels, next open // channel request should cause ErrorGeneric to be sent back to Alice. ctx, _ = context.WithTimeout(context.Background(), timeout) - _, err = net.OpenChannel(ctx, net.Alice, carol, amount, 0, false) + _, err = net.OpenChannel( + ctx, net.Alice, carol, amount, 0, false, true, + ) if err == nil { t.Fatalf("error wasn't received") } else if grpc.Code(err) != lnwire.ErrMaxPendingChannels.ToGrpcCode() { diff --git a/lntest/harness.go b/lntest/harness.go index 1a6ed867..fd0b4078 100644 --- a/lntest/harness.go +++ b/lntest/harness.go @@ -676,10 +676,12 @@ func (n *NetworkHarness) WaitForTxBroadcast(ctx context.Context, txid chainhash. // OpenChannel attempts to open a channel between srcNode and destNode with the // passed channel funding parameters. If the passed context has a timeout, then // if the timeout is reached before the channel pending notification is -// received, an error is returned. +// received, an error is returned. The confirmed boolean determines whether we +// should fund the channel with confirmed outputs or not. func (n *NetworkHarness) OpenChannel(ctx context.Context, srcNode, destNode *HarnessNode, amt btcutil.Amount, - pushAmt btcutil.Amount, private bool) (lnrpc.Lightning_OpenChannelClient, error) { + pushAmt btcutil.Amount, + private, confirmed bool) (lnrpc.Lightning_OpenChannelClient, error) { // Wait until srcNode and destNode have the latest chain synced. // Otherwise, we may run into a check within the funding manager that @@ -692,11 +694,17 @@ func (n *NetworkHarness) OpenChannel(ctx context.Context, return nil, fmt.Errorf("Unable to sync destNode chain: %v", err) } + minConfs := int32(0) + if confirmed { + minConfs = 1 + } + openReq := &lnrpc.OpenChannelRequest{ NodePubkey: destNode.PubKey[:], LocalFundingAmount: int64(amt), PushSat: int64(pushAmt), Private: private, + MinConfs: minConfs, } respStream, err := srcNode.OpenChannel(ctx, openReq)