-
Notifications
You must be signed in to change notification settings - Fork 78
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
Fix MPT branch node strip after deletion #2034
Conversation
pkg/core/native/native_nep17.go
Outdated
@@ -173,11 +173,12 @@ func (c *nep17TokenNative) updateAccBalance(ic *interop.Context, acc util.Uint16 | |||
return errors.New("insufficient funds") | |||
} | |||
si = state.StorageItem{} | |||
} else if amount.Sign() == 0 && requiredBalance != nil { | |||
} else if amount.Sign() <= 0 && requiredBalance != 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.
Ugh...
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.
Maybe it's better to put back si
after receiving an error from incBalance
? Otherwise we're unwrapping/comparing the balance twice.
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.
What about this though?
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.
Fixed, forgot to push.
pkg/core/native/native_nep17.go
Outdated
@@ -173,11 +173,12 @@ func (c *nep17TokenNative) updateAccBalance(ic *interop.Context, acc util.Uint16 | |||
return errors.New("insufficient funds") | |||
} | |||
si = state.StorageItem{} | |||
} else if amount.Sign() == 0 && requiredBalance != nil { | |||
} else if amount.Sign() <= 0 && requiredBalance != 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.
Maybe it's better to put back si
after receiving an error from incBalance
? Otherwise we're unwrapping/comparing the balance twice.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
If the child left is a hash node, we should retrieve it from store. Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
If the only child left is hash node, we need to retrieve it from storage.
Another commit fixes only state dump.
After the restore node seems (waited for a couple of minutes) to be adding state roots without errors.