diff --git a/XDCx/order_processor.go b/XDCx/order_processor.go index 86d156fec8..109831f20c 100644 --- a/XDCx/order_processor.go +++ b/XDCx/order_processor.go @@ -656,9 +656,10 @@ func (XDCx *XDCX) ProcessCancelOrder(header *types.Header, tradingStateDB *tradi } log.Debug("ProcessCancelOrder", "baseToken", originOrder.BaseToken, "quoteToken", originOrder.QuoteToken) feeRate := tradingstate.GetExRelayerFee(originOrder.ExchangeAddress, statedb) - tokenCancelFee, tokenPriceInXDC := common.Big0, common.Big0 + var tokenCancelFee, tokenPriceInXDC *big.Int if !chain.Config().IsTIPXDCXCancellationFee(header.Number) { tokenCancelFee = getCancelFeeV1(baseTokenDecimal, feeRate, &originOrder) + tokenPriceInXDC = common.Big0 } else { tokenCancelFee, tokenPriceInXDC = XDCx.getCancelFee(chain, statedb, tradingStateDB, &originOrder, feeRate) } @@ -721,7 +722,7 @@ func (XDCx *XDCX) ProcessCancelOrder(header *types.Header, tradingStateDB *tradi // cancellation fee = 1/10 trading fee // deprecated after hardfork at TIPXDCXCancellationFee func getCancelFeeV1(baseTokenDecimal *big.Int, feeRate *big.Int, order *tradingstate.OrderItem) *big.Int { - cancelFee := big.NewInt(0) + var cancelFee *big.Int if order.Side == tradingstate.Ask { // SELL 1 BTC => XDC ,, // order.Quantity =1 && fee rate =2 @@ -748,8 +749,7 @@ func (XDCx *XDCX) getCancelFee(chain consensus.ChainContext, statedb *state.Stat if feeRate == nil || feeRate.Sign() == 0 { return common.Big0, common.Big0 } - cancelFee := big.NewInt(0) - tokenPriceInXDC := big.NewInt(0) + var cancelFee, tokenPriceInXDC *big.Int var err error if order.Side == tradingstate.Ask { cancelFee, tokenPriceInXDC, err = XDCx.ConvertXDCToToken(chain, statedb, tradingStateDb, order.BaseToken, common.RelayerCancelFee) diff --git a/XDCxlending/XDCxlending.go b/XDCxlending/XDCxlending.go index 48ff540778..27c5e68cc5 100644 --- a/XDCxlending/XDCxlending.go +++ b/XDCxlending/XDCxlending.go @@ -311,7 +311,7 @@ func (l *Lending) SyncDataToSDKNode(chain consensus.ChainContext, statedb *state } // maker dirty order makerFilledAmount := big.NewInt(0) - makerOrderHash := common.Hash{} + var makerOrderHash common.Hash if updatedTakerLendingItem.Side == lendingstate.Borrowing { makerOrderHash = tradeRecord.InvestingOrderHash } else { diff --git a/XDCxlending/lendingstate/lendingitem.go b/XDCxlending/lendingstate/lendingitem.go index dd4553ab87..200ffb920b 100644 --- a/XDCxlending/lendingstate/lendingitem.go +++ b/XDCxlending/lendingstate/lendingitem.go @@ -411,7 +411,7 @@ func VerifyBalance(isXDCXLendingFork bool, statedb *state.StateDB, lendingStateD if lendTokenXDCPrice != nil && lendTokenXDCPrice.Sign() > 0 { defaultFee := new(big.Int).Mul(quantity, new(big.Int).SetUint64(DefaultFeeRate)) defaultFee = new(big.Int).Div(defaultFee, common.XDCXBaseFee) - defaultFeeInXDC := common.Big0 + var defaultFeeInXDC *big.Int if lendingToken != common.XDCNativeAddressBinary { defaultFeeInXDC = new(big.Int).Mul(defaultFee, lendTokenXDCPrice) defaultFeeInXDC = new(big.Int).Div(defaultFeeInXDC, lendingTokenDecimal) @@ -429,8 +429,7 @@ func VerifyBalance(isXDCXLendingFork bool, statedb *state.StateDB, lendingStateD // make sure actualBalance >= cancel fee lendingBook := GetLendingOrderBookHash(lendingToken, term) item := lendingStateDb.GetLendingOrder(lendingBook, common.BigToHash(new(big.Int).SetUint64(lendingId))) - cancelFee := big.NewInt(0) - cancelFee = new(big.Int).Mul(item.Quantity, borrowingFeeRate) + cancelFee := new(big.Int).Mul(item.Quantity, borrowingFeeRate) cancelFee = new(big.Int).Div(cancelFee, common.XDCXBaseCancelFee) actualBalance := GetTokenBalance(userAddress, lendingToken, statedb) @@ -459,9 +458,8 @@ func VerifyBalance(isXDCXLendingFork bool, statedb *state.StateDB, lendingStateD case LendingStatusCancelled: lendingBook := GetLendingOrderBookHash(lendingToken, term) item := lendingStateDb.GetLendingOrder(lendingBook, common.BigToHash(new(big.Int).SetUint64(lendingId))) - cancelFee := big.NewInt(0) // Fee == quantityToLend/base lend token decimal *price*borrowFee/LendingCancelFee - cancelFee = new(big.Int).Div(item.Quantity, collateralPrice) + cancelFee := new(big.Int).Div(item.Quantity, collateralPrice) cancelFee = new(big.Int).Mul(cancelFee, borrowingFeeRate) cancelFee = new(big.Int).Div(cancelFee, common.XDCXBaseCancelFee) actualBalance := GetTokenBalance(userAddress, collateralToken, statedb) diff --git a/XDCxlending/order_processor.go b/XDCxlending/order_processor.go index 5af2d27713..9c2edc227d 100644 --- a/XDCxlending/order_processor.go +++ b/XDCxlending/order_processor.go @@ -727,9 +727,10 @@ func (l *Lending) ProcessCancelOrder(header *types.Header, lendingStateDB *lendi } } feeRate := lendingstate.GetFee(statedb, originOrder.Relayer) - tokenCancelFee, tokenPriceInXDC := common.Big0, common.Big0 + var tokenCancelFee, tokenPriceInXDC *big.Int if !chain.Config().IsTIPXDCXCancellationFee(header.Number) { tokenCancelFee = getCancelFeeV1(collateralTokenDecimal, collateralPrice, feeRate, &originOrder) + tokenPriceInXDC = common.Big0 } else { tokenCancelFee, tokenPriceInXDC = l.getCancelFee(chain, statedb, tradingStateDb, &originOrder, feeRate) } @@ -927,7 +928,7 @@ func (l *Lending) LiquidationTrade(lendingStateDB *lendingstate.LendingStateDB, // cancellation fee = 1/10 borrowing fee // deprecated after hardfork at TIPXDCXCancellationFee func getCancelFeeV1(collateralTokenDecimal *big.Int, collateralPrice, borrowFee *big.Int, order *lendingstate.LendingItem) *big.Int { - cancelFee := big.NewInt(0) + var cancelFee *big.Int if order.Side == lendingstate.Investing { // cancel fee = quantityToLend*borrowFee/LendingCancelFee cancelFee = new(big.Int).Mul(order.Quantity, borrowFee) @@ -947,7 +948,7 @@ func (l *Lending) getCancelFee(chain consensus.ChainContext, statedb *state.Stat if feeRate == nil || feeRate.Sign() == 0 { return common.Big0, common.Big0 } - cancelFee, tokenPriceInXDC := common.Big0, common.Big0 + var cancelFee, tokenPriceInXDC *big.Int var err error if order.Side == lendingstate.Investing { cancelFee, tokenPriceInXDC, err = l.XDCx.ConvertXDCToToken(chain, statedb, tradingStateDb, order.LendingToken, common.RelayerLendingCancelFee) diff --git a/bmt/bmt.go b/bmt/bmt.go index 4b65b1d94a..bba4f86039 100644 --- a/bmt/bmt.go +++ b/bmt/bmt.go @@ -394,7 +394,7 @@ func (self *Hasher) ReadFrom(r io.Reader) (m int64, err error) { if err != nil { break } - n, err = self.Write(buf[:n]) + _, err = self.Write(buf[:n]) if err != nil { break } diff --git a/contracts/trc21issuer/simulation/test/main.go b/contracts/trc21issuer/simulation/test/main.go index 1ee2aff60e..489a7e24ef 100644 --- a/contracts/trc21issuer/simulation/test/main.go +++ b/contracts/trc21issuer/simulation/test/main.go @@ -43,7 +43,7 @@ func airDropTokenToAccountNoXDC() { fmt.Println("wait 10s to airdrop success ", tx.Hash().Hex()) time.Sleep(10 * time.Second) - _, receiptRpc, err := client.GetTransactionReceiptResult(context.Background(), tx.Hash()) + _, receiptRpc, _ := client.GetTransactionReceiptResult(context.Background(), tx.Hash()) receipt := map[string]interface{}{} err = json.Unmarshal(receiptRpc, &receipt) if err != nil { @@ -80,8 +80,8 @@ func testTransferTRC21TokenWithAccountNoXDC() { trc21IssuerInstance, _ := trc21issuer.NewTRC21Issuer(airDropAccount, common.TRC21IssuerSMC, client) remainFee, _ := trc21IssuerInstance.GetTokenCapacity(trc21TokenAddr) - airDropBalanceBefore, err := trc21Instance.BalanceOf(simulation.AirdropAddr) - receiverBalanceBefore, err := trc21Instance.BalanceOf(simulation.ReceiverAddr) + airDropBalanceBefore, _ := trc21Instance.BalanceOf(simulation.AirdropAddr) + receiverBalanceBefore, _ := trc21Instance.BalanceOf(simulation.ReceiverAddr) // execute transferAmount trc to other address tx, err := trc21Instance.Transfer(simulation.ReceiverAddr, simulation.TransferAmount) if err != nil { @@ -105,7 +105,7 @@ func testTransferTRC21TokenWithAccountNoXDC() { if err != nil || balance.Cmp(remainAirDrop) != 0 { log.Fatal("check balance after fail transferAmount in tr21: ", err, "get", balance, "wanted", remainAirDrop) } - _, receiptRpc, err := client.GetTransactionReceiptResult(context.Background(), tx.Hash()) + _, receiptRpc, _ := client.GetTransactionReceiptResult(context.Background(), tx.Hash()) receipt := map[string]interface{}{} err = json.Unmarshal(receiptRpc, &receipt) if err != nil { @@ -140,15 +140,15 @@ func testTransferTrc21Fail() { airDropAccount.GasPrice = big.NewInt(0).Mul(common.TRC21GasPrice, big.NewInt(2)) trc21Instance, _ := trc21issuer.NewTRC21(airDropAccount, trc21TokenAddr, client) trc21IssuerInstance, _ := trc21issuer.NewTRC21Issuer(airDropAccount, common.TRC21IssuerSMC, client) - balanceIssuerFee, err := trc21IssuerInstance.GetTokenCapacity(trc21TokenAddr) + balanceIssuerFee, _ := trc21IssuerInstance.GetTokenCapacity(trc21TokenAddr) minFee, err := trc21Instance.MinFee() if err != nil { log.Fatal("can't get minFee of trc21 smart contract:", err) } - ownerBalance, err := trc21Instance.BalanceOf(simulation.MainAddr) - remainFee, err := trc21IssuerInstance.GetTokenCapacity(trc21TokenAddr) - airDropBalanceBefore, err := trc21Instance.BalanceOf(simulation.AirdropAddr) + ownerBalance, _ := trc21Instance.BalanceOf(simulation.MainAddr) + remainFee, _ := trc21IssuerInstance.GetTokenCapacity(trc21TokenAddr) + airDropBalanceBefore, _ := trc21Instance.BalanceOf(simulation.AirdropAddr) tx, err := trc21Instance.Transfer(common.Address{}, big.NewInt(1)) if err != nil { @@ -171,7 +171,7 @@ func testTransferTrc21Fail() { if err != nil || balance.Cmp(ownerBalance) != 0 { log.Fatal("can't get balance token fee in smart contract: ", err, "got", balanceIssuerFee, "wanted", remainFee) } - _, receiptRpc, err := client.GetTransactionReceiptResult(context.Background(), tx.Hash()) + _, receiptRpc, _ := client.GetTransactionReceiptResult(context.Background(), tx.Hash()) receipt := map[string]interface{}{} err = json.Unmarshal(receiptRpc, &receipt) if err != nil { diff --git a/core/blockchain.go b/core/blockchain.go index fb98f45dab..8fbde7da23 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1271,8 +1271,6 @@ func (bc *BlockChain) WriteBlockWithState(block *types.Block, receipts []*types. if current := block.NumberU64(); current > triesInMemory { // Find the next state trie we need to commit chosen := current - triesInMemory - oldTradingRoot := common.Hash{} - oldLendingRoot := common.Hash{} // Only write to disk if we exceeded our memory allowance *and* also have at // least a given number of tries gapped. // @@ -1308,8 +1306,8 @@ func (bc *BlockChain) WriteBlockWithState(block *types.Block, receipts []*types. if tradingTrieDb != nil && lendingTrieDb != nil { b := bc.GetBlock(header.Hash(), current-triesInMemory) author, _ := bc.Engine().Author(b.Header()) - oldTradingRoot, _ = tradingService.GetTradingStateRoot(b, author) - oldLendingRoot, _ = lendingService.GetLendingStateRoot(b, author) + oldTradingRoot, _ := tradingService.GetTradingStateRoot(b, author) + oldLendingRoot, _ := lendingService.GetLendingStateRoot(b, author) tradingTrieDb.Commit(oldTradingRoot, true) lendingTrieDb.Commit(oldLendingRoot, true) } @@ -1647,8 +1645,7 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals bool) (int, [] } // liquidate / finalize open lendingTrades if block.Number().Uint64()%bc.chainConfig.XDPoS.Epoch == common.LiquidateLendingTradeBlock { - finalizedTrades := map[common.Hash]*lendingstate.LendingTrade{} - finalizedTrades, _, _, _, _, err = lendingService.ProcessLiquidationData(block.Header(), bc, statedb, tradingState, lendingState) + finalizedTrades, _, _, _, _, err := lendingService.ProcessLiquidationData(block.Header(), bc, statedb, tradingState, lendingState) if err != nil { return i, events, coalescedLogs, fmt.Errorf("failed to ProcessLiquidationData. Err: %v ", err) } diff --git a/core/blockchain_test.go b/core/blockchain_test.go index 87b58bf3ad..51e2122391 100644 --- a/core/blockchain_test.go +++ b/core/blockchain_test.go @@ -527,7 +527,7 @@ func testInsertNonceError(t *testing.T, full bool) { blockchain.engine = ethash.NewFakeFailer(failNum) blockchain.hc.engine = blockchain.engine - failRes, err = blockchain.InsertHeaderChain(headers, 1) + failRes, _ = blockchain.InsertHeaderChain(headers, 1) // Check that the returned error indicates the failure. if failRes != failAt { t.Errorf("test %d: failure index mismatch: have %d, want %d", i, failRes, failAt) diff --git a/core/lending_pool_test.go b/core/lending_pool_test.go index 5ffe82d58c..5a0dab8e35 100644 --- a/core/lending_pool_test.go +++ b/core/lending_pool_test.go @@ -58,7 +58,7 @@ func getLendingNonce(userAddress common.Address) (uint64, error) { s := result.(string) s = strings.TrimPrefix(s, "0x") n, err := strconv.ParseUint(s, 16, 32) - return uint64(n), nil + return uint64(n), err } func (l *LendingMsg) computeHash() common.Hash { diff --git a/core/order_pool_test.go b/core/order_pool_test.go index 1f03c692ee..6029e92820 100644 --- a/core/order_pool_test.go +++ b/core/order_pool_test.go @@ -49,7 +49,6 @@ var ( EOSAddress = common.HexToAddress("0xd9bb01454c85247B2ef35BB5BE57384cC275a8cf") USDAddress = common.HexToAddress("0x45c25041b8e6CBD5c963E7943007187C3673C7c9") _1E18 = new(big.Int).Mul(big.NewInt(10000000000000000), big.NewInt(100)) - _1E17 = new(big.Int).Mul(big.NewInt(10000000000000000), big.NewInt(10)) _1E8 = big.NewInt(100000000) _1E7 = big.NewInt(10000000) ) @@ -72,7 +71,7 @@ func getNonce(t *testing.T, userAddress common.Address) (uint64, error) { s := result.(string) s = strings.TrimPrefix(s, "0x") n, err := strconv.ParseUint(s, 16, 32) - return uint64(n), nil + return uint64(n), err } func testSendOrder(t *testing.T, amount, price *big.Int, side string, status string, orderID uint64) { diff --git a/core/vm/privacy/bulletproof.go b/core/vm/privacy/bulletproof.go index f620d230b2..37d8522afe 100644 --- a/core/vm/privacy/bulletproof.go +++ b/core/vm/privacy/bulletproof.go @@ -608,8 +608,6 @@ Delta is a helper function that is used in the range proof */ func Delta(y []*big.Int, z *big.Int) *big.Int { - result := big.NewInt(0) - // (z-z^2)<1^n, y^n> z2 := new(big.Int).Mod(new(big.Int).Mul(z, z), EC.N) t1 := new(big.Int).Mod(new(big.Int).Sub(z, z2), EC.N) @@ -620,21 +618,14 @@ func Delta(y []*big.Int, z *big.Int) *big.Int { po2sum := new(big.Int).Sub(new(big.Int).Exp(big.NewInt(2), big.NewInt(int64(EC.V)), EC.N), big.NewInt(1)) t3 := new(big.Int).Mod(new(big.Int).Mul(z3, po2sum), EC.N) - result = new(big.Int).Mod(new(big.Int).Sub(t2, t3), EC.N) - - return result + return new(big.Int).Mod(new(big.Int).Sub(t2, t3), EC.N) } // Calculates (aL - z*1^n) + sL*x func CalculateL(aL, sL []*big.Int, z, x *big.Int) []*big.Int { - result := make([]*big.Int, len(aL)) - tmp1 := VectorAddScalar(aL, new(big.Int).Neg(z)) tmp2 := ScalarVectorMul(sL, x) - - result = VectorAdd(tmp1, tmp2) - - return result + return VectorAdd(tmp1, tmp2) } func CalculateR(aR, sR, y, po2 []*big.Int, z, x *big.Int) []*big.Int { @@ -642,29 +633,20 @@ func CalculateR(aR, sR, y, po2 []*big.Int, z, x *big.Int) []*big.Int { log.Info("CalculateR: Arrays not of the same length") } - result := make([]*big.Int, len(aR)) - z2 := new(big.Int).Exp(z, big.NewInt(2), EC.N) tmp11 := VectorAddScalar(aR, z) tmp12 := ScalarVectorMul(sR, x) tmp1 := VectorHadamard(y, VectorAdd(tmp11, tmp12)) tmp2 := ScalarVectorMul(po2, z2) - result = VectorAdd(tmp1, tmp2) - - return result + return VectorAdd(tmp1, tmp2) } // Calculates (aL - z*1^n) + sL*x func CalculateLMRP(aL, sL []*big.Int, z, x *big.Int) []*big.Int { - result := make([]*big.Int, len(aL)) - tmp1 := VectorAddScalar(aL, new(big.Int).Neg(z)) tmp2 := ScalarVectorMul(sL, x) - - result = VectorAdd(tmp1, tmp2) - - return result + return VectorAdd(tmp1, tmp2) } func CalculateRMRP(aR, sR, y, zTimesTwo []*big.Int, z, x *big.Int) []*big.Int { @@ -672,15 +654,11 @@ func CalculateRMRP(aR, sR, y, zTimesTwo []*big.Int, z, x *big.Int) []*big.Int { log.Info("CalculateRMRP: Arrays not of the same length") } - result := make([]*big.Int, len(aR)) - tmp11 := VectorAddScalar(aR, z) tmp12 := ScalarVectorMul(sR, x) tmp1 := VectorHadamard(y, VectorAdd(tmp11, tmp12)) - result = VectorAdd(tmp1, zTimesTwo) - - return result + return VectorAdd(tmp1, zTimesTwo) } /* @@ -689,8 +667,6 @@ DeltaMRP is a helper function that is used in the multi range proof */ func DeltaMRP(y []*big.Int, z *big.Int, m int) *big.Int { - result := big.NewInt(0) - // (z-z^2)<1^n, y^n> z2 := new(big.Int).Mod(new(big.Int).Mul(z, z), EC.N) t1 := new(big.Int).Mod(new(big.Int).Sub(z, z2), EC.N) @@ -709,9 +685,7 @@ func DeltaMRP(y []*big.Int, z *big.Int, m int) *big.Int { t3 = new(big.Int).Mod(new(big.Int).Add(t3, tmp1), EC.N) } - result = new(big.Int).Mod(new(big.Int).Sub(t2, t3), EC.N) - - return result + return new(big.Int).Mod(new(big.Int).Sub(t2, t3), EC.N) } type MultiRangeProof struct { diff --git a/core/vm/privacy/ringct_test.go b/core/vm/privacy/ringct_test.go index 3e5b771c0b..b3370497a0 100644 --- a/core/vm/privacy/ringct_test.go +++ b/core/vm/privacy/ringct_test.go @@ -21,7 +21,7 @@ func TestSign(t *testing.T) { ringSize := 10 s := 9 fmt.Println("Generate random ring parameter ") - rings, privkeys, m, err := GenerateMultiRingParams(numRing, ringSize, s) + rings, privkeys, m, _ := GenerateMultiRingParams(numRing, ringSize, s) fmt.Println("numRing ", numRing) fmt.Println("ringSize ", ringSize) @@ -57,7 +57,7 @@ func TestDeserialize(t *testing.T) { numRing := 5 ringSize := 10 s := 5 - rings, privkeys, m, err := GenerateMultiRingParams(numRing, ringSize, s) + rings, privkeys, m, _ := GenerateMultiRingParams(numRing, ringSize, s) ringSignature, err := Sign(m, rings, privkeys, s) if err != nil { @@ -235,7 +235,7 @@ func TestOnCurveVerify(t *testing.T) { numRing := 5 ringSize := 10 s := 5 - rings, privkeys, m, err := GenerateMultiRingParams(numRing, ringSize, s) + rings, privkeys, m, _ := GenerateMultiRingParams(numRing, ringSize, s) ringSignature, err := Sign(m, rings, privkeys, s) if err != nil { t.Error("Failed to create Ring signature") @@ -259,7 +259,7 @@ func TestOnCurveDeserialize(t *testing.T) { numRing := 5 ringSize := 10 s := 5 - rings, privkeys, m, err := GenerateMultiRingParams(numRing, ringSize, s) + rings, privkeys, m, _ := GenerateMultiRingParams(numRing, ringSize, s) ringSignature, err := Sign(m, rings, privkeys, s) if err != nil { t.Error("Failed to create Ring signature") @@ -304,7 +304,7 @@ func TestNilPointerDereferencePanic(t *testing.T) { numRing := 5 ringSize := 10 s := 7 - rings, privkeys, m, err := GenerateMultiRingParams(numRing, ringSize, s) + rings, privkeys, m, _ := GenerateMultiRingParams(numRing, ringSize, s) ringSig, err := Sign(m, rings, privkeys, s) if err != nil { @@ -318,7 +318,7 @@ func TestNilPointerDereferencePanic(t *testing.T) { t.Error("Failed to Serialize input Ring signature") } - _ , err = Deserialize(sig) + _, err = Deserialize(sig) // Should failed to verify Ring signature as the signature is invalid assert.EqualError(t, err, "failed to deserialize, invalid ring signature") } diff --git a/crypto/bn256/cloudflare/optate.go b/crypto/bn256/cloudflare/optate.go index b71e50e3a2..e8caa7a086 100644 --- a/crypto/bn256/cloudflare/optate.go +++ b/crypto/bn256/cloudflare/optate.go @@ -199,9 +199,8 @@ func miller(q *twistPoint, p *curvePoint) *gfP12 { r = newR r2.Square(&minusQ2.y) - a, b, c, newR = lineFunctionAdd(r, minusQ2, bAffine, r2) + a, b, c, _ = lineFunctionAdd(r, minusQ2, bAffine, r2) mulLine(ret, a, b, c) - r = newR return ret } diff --git a/metrics/registry_test.go b/metrics/registry_test.go index 3b4c8def7c..416c82d0b2 100644 --- a/metrics/registry_test.go +++ b/metrics/registry_test.go @@ -270,7 +270,7 @@ func TestChildPrefixedRegistryOfChildRegister(t *testing.T) { if err != nil { t.Fatal(err.Error()) } - err = r2.Register("baz", NewCounter()) + r2.Register("baz", NewCounter()) c := NewCounter() Register("bars", c) @@ -293,7 +293,7 @@ func TestWalkRegistries(t *testing.T) { if err != nil { t.Fatal(err.Error()) } - err = r2.Register("baz", NewCounter()) + r2.Register("baz", NewCounter()) c := NewCounter() Register("bars", c) diff --git a/whisper/mailserver/server_test.go b/whisper/mailserver/server_test.go index ced1c156c2..6925d2999a 100644 --- a/whisper/mailserver/server_test.go +++ b/whisper/mailserver/server_test.go @@ -169,7 +169,7 @@ func singleRequest(t *testing.T, server *WMailServer, env *whisper.Envelope, p * } src[0]++ - ok, lower, upper, bloom = server.validateRequest(src, request) + ok, lower, upper, _ = server.validateRequest(src, request) if !ok { // request should be valid regardless of signature t.Fatalf("request validation false negative, seed: %d (lower: %d, upper: %d).", seed, lower, upper) diff --git a/whisper/whisperv6/filter_test.go b/whisper/whisperv6/filter_test.go index 03449b88a3..20ef3c0503 100644 --- a/whisper/whisperv6/filter_test.go +++ b/whisper/whisperv6/filter_test.go @@ -309,7 +309,7 @@ func TestMatchEnvelope(t *testing.T) { if err != nil { t.Fatalf("failed to create new message with seed %d: %s.", seed, err) } - env, err := msg.Wrap(params) + _, err = msg.Wrap(params) if err != nil { t.Fatalf("failed Wrap with seed %d: %s.", seed, err) } @@ -322,7 +322,7 @@ func TestMatchEnvelope(t *testing.T) { if err != nil { t.Fatalf("failed to create new message with seed %d: %s.", seed, err) } - env, err = msg.Wrap(params) + env, err := msg.Wrap(params) if err != nil { t.Fatalf("failed Wrap() with seed %d: %s.", seed, err) }