-
Notifications
You must be signed in to change notification settings - Fork 324
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
refactor StateManger/StateReader #1886
refactor StateManger/StateReader #1886
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1886 +/- ##
=========================================
- Coverage 61.37% 61.3% -0.07%
=========================================
Files 161 161
Lines 13300 13321 +21
=========================================
+ Hits 8163 8167 +4
- Misses 4099 4113 +14
- Partials 1038 1041 +3
Continue to review full report at Codecov.
|
_, err = sm.State(&account, protocol.LegacyKeyOption(addrHash)) | ||
if err == nil { | ||
return &account, nil | ||
} | ||
if errors.Cause(err) == state.ErrStateNotExist { | ||
account.Balance = big.NewInt(0) | ||
account.VotingWeight = big.NewInt(0) | ||
if err := sm.PutState(addrHash, account); err != nil { | ||
if _, err := sm.PutState(account, protocol.LegacyKeyOption(addrHash)); err != 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.
this is the perfect place for us to check the versions (heights)
@@ -126,9 +125,9 @@ func TestActQueuePendingActs(t *testing.T) { | |||
require := require.New(t) | |||
cfg := config.Default | |||
sf := mock_factory.NewMockFactory(ctrl) | |||
sf.EXPECT().State(gomock.Any(), gomock.Any()).Do(func(_ hash.Hash160, accountState *state.Account) { | |||
sf.EXPECT().State(gomock.Any(), gomock.Any()).Do(func(accountState *state.Account, _ protocol.StateOption) { |
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.
is it
sf.EXPECT().State(gomock.Any(), gomock.Any()).Do(func(accountState *state.Account, _ ...protocol.StateOption) {
blockchain/blockchain.go
Outdated
@@ -601,6 +601,7 @@ func (bc *blockchain) commitBlock(ctx context.Context, blk *block.Block) error { | |||
sfTimer.End() | |||
// detach working set so it can be freed by GC | |||
if err != 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.
revert?
works on #1882