Skip to content

Commit b64ca14

Browse files
authored
block and uncle reward in PoA network = 0 (#87)
* in PoA networks there is no block and uncle rewards * bump meta version
1 parent f2f37f0 commit b64ca14

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

params/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const (
2424
VersionMajor = 1 // Major version component of the current release
2525
VersionMinor = 10 // Minor version component of the current release
2626
VersionPatch = 3 // Patch version component of the current release
27-
VersionMeta = "statediff-0.0.23" // Version metadata to append to the version string
27+
VersionMeta = "statediff-0.0.24" // Version metadata to append to the version string
2828
)
2929

3030
// Version holds the textual version string.

statediff/indexer/indexer.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,13 @@ func (sdi *StateDiffIndexer) PushBlock(block *types.Block, receipts types.Receip
119119
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))
120120
}
121121
// Calculate reward
122-
reward := CalcEthBlockReward(block.Header(), block.Uncles(), block.Transactions(), receipts)
122+
var reward *big.Int
123+
// in PoA networks block reward is 0
124+
if sdi.chainConfig.Clique != nil {
125+
reward = big.NewInt(0)
126+
} else {
127+
reward = CalcEthBlockReward(block.Header(), block.Uncles(), block.Transactions(), receipts)
128+
}
123129
t = time.Now()
124130
// Begin new db tx for everything
125131
tx, err := sdi.dbWriter.db.Beginx()
@@ -238,7 +244,13 @@ func (sdi *StateDiffIndexer) processUncles(tx *sqlx.Tx, headerID int64, blockNum
238244
if err := shared.PublishIPLD(tx, uncleNode); err != nil {
239245
return fmt.Errorf("error publishing uncle IPLD: %v", err)
240246
}
241-
uncleReward := CalcUncleMinerReward(blockNumber, uncleNode.Number.Uint64())
247+
var uncleReward *big.Int
248+
// in PoA networks uncle reward is 0
249+
if sdi.chainConfig.Clique != nil {
250+
uncleReward = big.NewInt(0)
251+
} else {
252+
uncleReward = CalcUncleMinerReward(blockNumber, uncleNode.Number.Uint64())
253+
}
242254
uncle := models.UncleModel{
243255
CID: uncleNode.Cid().String(),
244256
MhKey: shared.MultihashKeyFromCID(uncleNode.Cid()),

0 commit comments

Comments
 (0)