Skip to content

Commit

Permalink
bug fix: avoid 'bad block' after executing extrRwd transaction
Browse files Browse the repository at this point in the history
possible reason: when one block with extrRwd transaction inserted, the same block could be inserted again because the synchronize-mechanism. In theory this should not happen, but it happens. Then the rewardBalance could be wrongly calculated because lack of history-data in OutsideOfStorage reward, and 'bad block' comes.

fix: add 5('OBR_SIZE' in code) history data cache for OutsideOfStorage reward, and this can support 4(OBR_SIZE-1) blocks rollback; basically this should reduce the 'bad block' much

Test cases & expected results:
1, synchronize pchain from block 0 till the latest with no error
2, after new block with new extrRwd transaction inserted/reinserted, the 'bad block' should not appear, at least the frequency should be very very low
  • Loading branch information
pchain-org committed Jan 14, 2021
1 parent ec48c7c commit e719c81
Show file tree
Hide file tree
Showing 10 changed files with 193 additions and 73 deletions.
59 changes: 59 additions & 0 deletions vendor/github.com/ethereum/go-ethereum/common/out_of_storage.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions vendor/github.com/ethereum/go-ethereum/consensus/pdbft/engine.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions vendor/github.com/ethereum/go-ethereum/core/blockchain.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions vendor/github.com/ethereum/go-ethereum/core/rawdb/schema.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e719c81

Please sign in to comment.