-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added writing of genesis.Alloc
on bootstrap
#15
Added writing of genesis.Alloc
on bootstrap
#15
Conversation
core/blockchain.go
Outdated
@@ -406,6 +406,34 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis *Genesis | |||
} | |||
} | |||
|
|||
if bc.logger != nil && bc.CurrentBlock().Number.Uint64() == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, so we want to only emit this event on the first sync? Asking because you have the currentBlock == 0
check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we have the state that tells us if it's a first sync or not. I would like to have OnGenesisBlock
called only once indeed!
…ll also fill the missing value now
24e52d7
to
0856f27
Compare
Updated with the fact that genesis state spec is already written, only modified |
core/genesis.go
Outdated
alloc = genesis.Alloc | ||
} else { | ||
return errors.New("not found") | ||
return nil, true, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need found
? a nil
alloc could mean not found
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we can do that.
core/genesis.go
Outdated
} | ||
|
||
if !found { | ||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used to return errors.New("not found")
in this case. What's the reason for this behavior change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's was a mistake indeed, I'll revert this
genesis.Alloc
on bootstrap, geth init
also fills the missing valuegenesis.Alloc
on bootstrap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.