mirror of https://github.com/BTCPrivate/lnd.git
test: only assert pending close channels if didn't force close
This commit is contained in:
parent
18a2c8a455
commit
533cd69c7b
34
lnd_test.go
34
lnd_test.go
|
@ -188,22 +188,24 @@ func closeChannelAndAssert(ctx context.Context, t *harnessTest, net *networkHarn
|
||||||
}
|
}
|
||||||
chanPointStr := fmt.Sprintf("%v:%v", txid, fundingChanPoint.OutputIndex)
|
chanPointStr := fmt.Sprintf("%v:%v", txid, fundingChanPoint.OutputIndex)
|
||||||
|
|
||||||
// At this point, the channel should now be marked as being in the
|
// If we didn't force close the transaction, at this point, the channel
|
||||||
// state of "pending close".
|
// should now be marked as being in the state of "pending close".
|
||||||
pendingChansRequest := &lnrpc.PendingChannelRequest{}
|
if !force {
|
||||||
pendingChanResp, err := node.PendingChannels(ctx, pendingChansRequest)
|
pendingChansRequest := &lnrpc.PendingChannelRequest{}
|
||||||
if err != nil {
|
pendingChanResp, err := node.PendingChannels(ctx, pendingChansRequest)
|
||||||
t.Fatalf("unable to query for pending channels: %v", err)
|
if err != nil {
|
||||||
}
|
t.Fatalf("unable to query for pending channels: %v", err)
|
||||||
var found bool
|
}
|
||||||
for _, pendingClose := range pendingChanResp.PendingClosingChannels {
|
var found bool
|
||||||
if pendingClose.Channel.ChannelPoint == chanPointStr {
|
for _, pendingClose := range pendingChanResp.PendingClosingChannels {
|
||||||
found = true
|
if pendingClose.Channel.ChannelPoint == chanPointStr {
|
||||||
break
|
found = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !found {
|
||||||
|
t.Fatalf("channel not marked as pending close")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !found {
|
|
||||||
t.Fatalf("channel not marked as pending close")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finally, generate a single block, wait for the final close status
|
// Finally, generate a single block, wait for the final close status
|
||||||
|
@ -442,7 +444,7 @@ peersPoll:
|
||||||
OutputIndex: pendingUpdate.OutputIndex,
|
OutputIndex: pendingUpdate.OutputIndex,
|
||||||
}
|
}
|
||||||
ctxt, _ = context.WithTimeout(ctxb, timeout)
|
ctxt, _ = context.WithTimeout(ctxb, timeout)
|
||||||
closeChannelAndAssert(ctxt, t, net, net.Alice, chanPoint, true)
|
closeChannelAndAssert(ctxt, t, net, net.Alice, chanPoint, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// testChannelBalance creates a new channel between Alice and Bob, then
|
// testChannelBalance creates a new channel between Alice and Bob, then
|
||||||
|
|
Loading…
Reference in New Issue