mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 09:37:38 +00:00
dont check for block reward or uncles if we are tracing POS (#5410)
* dont check for block reward or uncles if we are tracing POS * comparing chainConfig to header difficulty * fixed test * difficulty == 0 then we are POS
This commit is contained in:
parent
62bbc36d11
commit
7b1bf44ce6
@ -325,6 +325,7 @@ func (api *TraceAPIImpl) Filter(ctx context.Context, req TraceFilterRequest, str
|
|||||||
nExported := uint64(0)
|
nExported := uint64(0)
|
||||||
|
|
||||||
it := allBlocks.Iterator()
|
it := allBlocks.Iterator()
|
||||||
|
isPos := false
|
||||||
for it.HasNext() {
|
for it.HasNext() {
|
||||||
b := it.Next()
|
b := it.Next()
|
||||||
// Extract transactions from block
|
// Extract transactions from block
|
||||||
@ -367,6 +368,10 @@ func (api *TraceAPIImpl) Filter(ctx context.Context, req TraceFilterRequest, str
|
|||||||
|
|
||||||
blockHash := block.Hash()
|
blockHash := block.Hash()
|
||||||
blockNumber := block.NumberU64()
|
blockNumber := block.NumberU64()
|
||||||
|
if !isPos && api._chainConfig.TerminalTotalDifficulty != nil {
|
||||||
|
header := block.Header()
|
||||||
|
isPos = header.Difficulty.Cmp(common.Big0) == 0 || header.Difficulty.Cmp(api._chainConfig.TerminalTotalDifficulty) >= 0
|
||||||
|
}
|
||||||
txs := block.Transactions()
|
txs := block.Transactions()
|
||||||
t, tErr := api.callManyTransactions(ctx, dbtx, txs, []string{TraceTypeTrace}, block.ParentHash(), rpc.BlockNumber(block.NumberU64()-1), block.Header(), -1 /* all tx indices */, types.MakeSigner(chainConfig, b), chainConfig.Rules(b))
|
t, tErr := api.callManyTransactions(ctx, dbtx, txs, []string{TraceTypeTrace}, block.ParentHash(), rpc.BlockNumber(block.NumberU64()-1), block.Header(), -1 /* all tx indices */, types.MakeSigner(chainConfig, b), chainConfig.Rules(b))
|
||||||
if tErr != nil {
|
if tErr != nil {
|
||||||
@ -416,6 +421,13 @@ func (api *TraceAPIImpl) Filter(ctx context.Context, req TraceFilterRequest, str
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if we are in POS
|
||||||
|
// we dont check for uncles or block rewards
|
||||||
|
if isPos {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
minerReward, uncleRewards := ethash.AccumulateRewards(chainConfig, block.Header(), block.Uncles())
|
minerReward, uncleRewards := ethash.AccumulateRewards(chainConfig, block.Header(), block.Uncles())
|
||||||
if _, ok := toAddresses[block.Coinbase()]; ok || includeAll {
|
if _, ok := toAddresses[block.Coinbase()]; ok || includeAll {
|
||||||
nSeen++
|
nSeen++
|
||||||
|
@ -616,6 +616,10 @@ func verifyAndSaveDownloadedPoSHeaders(tx kv.RwTx, cfg HeadersCfg, headerInserte
|
|||||||
|
|
||||||
headerLoadFunc := func(key, value []byte, _ etl.CurrentTableReader, _ etl.LoadNextFunc) error {
|
headerLoadFunc := func(key, value []byte, _ etl.CurrentTableReader, _ etl.LoadNextFunc) error {
|
||||||
var h types.Header
|
var h types.Header
|
||||||
|
// no header to process
|
||||||
|
if value == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if err := rlp.DecodeBytes(value, &h); err != nil {
|
if err := rlp.DecodeBytes(value, &h); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user