breacharbiter_test: add double handoff event

This commit is contained in:
Johan T. Halseth 2018-04-26 14:19:57 +02:00
parent e9eab3f79f
commit 690992043b
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -1018,6 +1018,32 @@ func TestBreachHandoffSuccess(t *testing.T) {
// retribution information and the channel should be shown as pending
// force closed.
assertArbiterBreach(t, brar, chanPoint)
// Send another breach event. Since the handoff for this channel was
// already ACKed, the breach arbiter should immediately ACK and ignore
// this event.
breach = &ContractBreachEvent{
ChanPoint: *chanPoint,
ProcessACK: make(chan error, 1),
BreachRetribution: &lnwallet.BreachRetribution{
BreachTransaction: bobClose.CloseTx,
},
}
contractBreaches <- breach
// We'll also wait to consume the ACK back from the breach arbiter.
select {
case err := <-breach.ProcessACK:
if err != nil {
t.Fatalf("handoff failed: %v", err)
}
case <-time.After(time.Second * 15):
t.Fatalf("breach arbiter didn't send ack back")
}
// State should not have changed.
assertArbiterBreach(t, brar, chanPoint)
}
// TestBreachHandoffFail tests that a channel's close observer properly