breacharbiter_test: select on quit chan on publication

Since publication would deadlock on publishing the tx in case the test
had failed we also select on the brar quit channel.
This commit is contained in:
Johan T. Halseth 2021-05-20 09:08:03 +02:00
parent dee6a1a29b
commit 07c0277f3b
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -1604,7 +1604,12 @@ func testBreachSpends(t *testing.T, test breachTest) {
publMtx.Lock()
err := publErr
publMtx.Unlock()
publTx <- tx
select {
case publTx <- tx:
case <-brar.quit:
return fmt.Errorf("brar quit")
}
return err
}
@ -1817,7 +1822,11 @@ func TestBreachDelayedJusticeConfirmation(t *testing.T) {
// Make PublishTransaction always return succeed.
brar.cfg.PublishTransaction = func(tx *wire.MsgTx, _ string) error {
publTx <- tx
select {
case publTx <- tx:
case <-brar.quit:
return fmt.Errorf("brar quit")
}
return nil
}