From d35cec9dfc6ab5959ae60d540ac72ef3379774fc Mon Sep 17 00:00:00 2001 From: Laxmi Prasad Oli Date: Tue, 2 May 2023 20:08:12 +0545 Subject: [PATCH] Save rewards only if miner exists in the network --- code/go/0chain.net/smartcontract/minersc/fees.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/code/go/0chain.net/smartcontract/minersc/fees.go b/code/go/0chain.net/smartcontract/minersc/fees.go index 03862e03b4..c65b9a2b95 100644 --- a/code/go/0chain.net/smartcontract/minersc/fees.go +++ b/code/go/0chain.net/smartcontract/minersc/fees.go @@ -380,10 +380,12 @@ func (msc *MinerSmartContract) payFees(t *transaction.Transaction, logging.Logger.Info("pay_fee could not find sharder to reward", zap.Int64("round", b.Round)) } - // save node first, for the VC pools work - if err = mn.save(balances); err != nil { - return "", common.NewErrorf("pay_fees", - "saving generator node: %v", err) + if mn != nil { + // save node first, for the VC pools work + if err = mn.save(balances); err != nil { + return "", common.NewErrorf("pay_fees", + "saving generator node: %v", err) + } } if gn.RewardRoundFrequency != 0 && b.Round%gn.RewardRoundFrequency == 0 {