Skip to content

Commit c81fbfa

Browse files
author
eric
committed
fix: insufficient balance for transfer on parlia::distributeRewards()
1 parent d7ac313 commit c81fbfa

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

consensus/parlia/parlia.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,11 @@ func (p *Parlia) distributeIncoming(val common.Address, state *state.StateDB, he
10741074
state.AddBalance(coinbase, balance)
10751075
rewards := big.NewInt(0).Abs(balance)
10761076
blockRewards := p.BlockRewards(header.Number)
1077-
rewards = rewards.Add(rewards, blockRewards)
1077+
if blockRewards.Cmp(common.Big0) > 0 {
1078+
rewards = rewards.Add(rewards, blockRewards)
1079+
state.AddBalance(coinbase, blockRewards)
1080+
}
1081+
10781082
if rewards.Cmp(common.Big0) <= 0 {
10791083
return nil
10801084
}

miner/worker.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,7 @@ func (w *worker) commit(uncles []*types.Header, interval func(), update bool, st
979979
}
980980
block, receipts, err := w.engine.FinalizeAndAssemble(w.chain, types.CopyHeader(w.current.header), s, w.current.txs, uncles, w.current.receipts)
981981
if err != nil {
982+
log.Warn("Miner worker commit failed", "block number", w.current.header.Number, " error", err)
982983
return err
983984
}
984985
if w.isRunning() {

0 commit comments

Comments
 (0)