Skip to content

Commit

Permalink
block and uncle reward in PoA network = 0 (#87)
Browse files Browse the repository at this point in the history
* in PoA networks there is no block and uncle rewards

* bump meta version

(cherry picked from commit b64ca14)
  • Loading branch information
ramilexe authored and arijitAD committed Jul 1, 2021
1 parent 3eb4467 commit 60eed58
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions statediff/indexer/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,13 @@ func (sdi *StateDiffIndexer) PushBlock(block *types.Block, receipts types.Receip
return nil, fmt.Errorf("expected number of transactions (%d), transaction trie nodes (%d), receipts (%d), and receipt trie nodes (%d)to be equal", len(txNodes), len(txTrieNodes), len(rctNodes), len(rctTrieNodes))
}
// Calculate reward
reward := CalcEthBlockReward(block.Header(), block.Uncles(), block.Transactions(), receipts)
var reward *big.Int
// in PoA networks block reward is 0
if sdi.chainConfig.Clique != nil {
reward = big.NewInt(0)
} else {
reward = CalcEthBlockReward(block.Header(), block.Uncles(), block.Transactions(), receipts)
}
t = time.Now()
// Begin new db tx for everything
tx, err := sdi.dbWriter.db.Beginx()
Expand Down Expand Up @@ -243,7 +249,13 @@ func (sdi *StateDiffIndexer) processUncles(tx *sqlx.Tx, headerID int64, blockNum
if err := shared.PublishIPLD(tx, uncleNode); err != nil {
return fmt.Errorf("error publishing uncle IPLD: %v", err)
}
uncleReward := CalcUncleMinerReward(blockNumber, uncleNode.Number.Uint64())
var uncleReward *big.Int
// in PoA networks uncle reward is 0
if sdi.chainConfig.Clique != nil {
uncleReward = big.NewInt(0)
} else {
uncleReward = CalcUncleMinerReward(blockNumber, uncleNode.Number.Uint64())
}
uncle := models.UncleModel{
CID: uncleNode.Cid().String(),
MhKey: shared.MultihashKeyFromCID(uncleNode.Cid()),
Expand Down

0 comments on commit 60eed58

Please sign in to comment.