From 34499406cf36c5407e20418833d74e241d37f010 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Sat, 11 Jun 2022 22:09:45 +0200 Subject: [PATCH] Simplify comparisons len(byte[][]) is defined as zero when the value is nil --- bchain/mq.go | 2 +- tests/dbtestdata/fakechain.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bchain/mq.go b/bchain/mq.go index 68dcca25..5f919209 100644 --- a/bchain/mq.go +++ b/bchain/mq.go @@ -92,7 +92,7 @@ func (mq *MQ) run(callback func(NotificationType)) { } else { repeatedError = false } - if msg != nil && len(msg) >= 3 { + if len(msg) >= 3 { var nt NotificationType switch string(msg[0]) { case "hashblock": diff --git a/tests/dbtestdata/fakechain.go b/tests/dbtestdata/fakechain.go index 8e37feb6..ffd02b1c 100644 --- a/tests/dbtestdata/fakechain.go +++ b/tests/dbtestdata/fakechain.go @@ -188,7 +188,7 @@ func (c *fakeBlockChain) GetTransactionForMempool(txid string) (v *bchain.Tx, er } func (c *fakeBlockChain) EstimateSmartFee(blocks int, conservative bool) (v big.Int, err error) { - if conservative == false { + if !conservative { v.SetInt64(int64(blocks)*100 - 1) } else { v.SetInt64(int64(blocks) * 100)