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

View File

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