Skip to content
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 vote::to_json() #1900

Merged
merged 2 commits into from Apr 12, 2019

Conversation

2 participants
@guilhermelawless
Copy link
Contributor

commented Apr 11, 2019

2 bugs:

First, it would crash at a block_hash variant:

terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::bad_get> >'
what():  boost::bad_get: failed value get using boost::get
Aborted (core dumped) 

Now, the block_hash variant is correctly handled.

Second, only one block would be serialized (overwritten on top of the last one). Now it serializes a list of all blocks. Tested with --vote_dump

@cryptocode cryptocode self-requested a review Apr 11, 2019

@cryptocode cryptocode added the bug label Apr 11, 2019

@cryptocode cryptocode added this to the V19.0 milestone Apr 11, 2019

@cryptocode cryptocode added this to CP3 (2019-04-10) in V19 Apr 11, 2019

@guilhermelawless

This comment has been minimized.

Copy link
Contributor Author

commented Apr 11, 2019

Just noticed, it's not actually serializing all blocks (e.g. 12 in a vbh), just one block. I will fix this.

@cryptocode do you mind if i split to_json to use a common serialize_json ?

@cryptocode

This comment has been minimized.

Copy link
Collaborator

commented Apr 11, 2019

Doing changes to vote's to_json should be fine, seems low risk too if only --vote_dump uses it.

@guilhermelawless

This comment has been minimized.

Copy link
Contributor Author

commented Apr 11, 2019

Updated the first comment.

@guilhermelawless guilhermelawless changed the title Fix vote::to_json() block_hash variant Fix vote::to_json() Apr 11, 2019

@cryptocode cryptocode merged commit 8976a81 into nanocurrency:master Apr 12, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@guilhermelawless guilhermelawless deleted the guilhermelawless:fix-vote-to-json branch Apr 12, 2019

guilhermelawless added a commit to guilhermelawless/nano-node that referenced this pull request Apr 15, 2019

Fix vote::to_json() (nanocurrency#1900)
* Fix vote::to_json() block_hash variant

* Serialize all votes and split into serialize_json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.