From 07c0277f3b91df6a30b291b2f258f56b6534c79b Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Thu, 20 May 2021 09:08:03 +0200 Subject: [PATCH] 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. --- breacharbiter_test.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/breacharbiter_test.go b/breacharbiter_test.go index 358a826a..68de9661 100644 --- a/breacharbiter_test.go +++ b/breacharbiter_test.go @@ -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 }