Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

Fix ChainParams::loadConfig not loading precompile configuration #5821

Merged
merged 4 commits into from
Nov 14, 2019

Conversation

gumb0
Copy link
Member

@gumb0 gumb0 commented Nov 13, 2019

This gets rid of a weird pattern where ChainParams::loadConfig first created another ChainParams instance by copying *this, then applied config values from JSON on top of it, then ChainParams constuctor assigned result of loadConfig to *this.

Instead of this, there's now just a normal ChainParams constructor taking JSON string. loadConfig is made private and modifies members of current object. The same with loadGenesis.

Fixes #5819

@codecov-io
Copy link

codecov-io commented Nov 14, 2019

Codecov Report

Merging #5821 into master will decrease coverage by 0.01%.
The diff coverage is 98.03%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5821      +/-   ##
==========================================
- Coverage   64.14%   64.12%   -0.02%     
==========================================
  Files         360      360              
  Lines       30868    30866       -2     
  Branches     3428     3428              
==========================================
- Hits        19801    19794       -7     
- Misses       9839     9842       +3     
- Partials     1228     1230       +2

insert method of the precompile map was not changing anything when previous map already contained the same key. Now loading config always starts with default-initialized ChainParams (with empty precompile map)
Copy link
Member

@chfast chfast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

@gumb0 gumb0 merged commit 6f3bca4 into master Nov 14, 2019
@gumb0 gumb0 deleted the loadconfig-precompiles branch November 14, 2019 17:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test_setChainParams incorrectly initializes precompiles
3 participants