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

Add warning message when vote version is older than blockheader's StakeVersion #758

Merged
merged 8 commits into from
Jun 6, 2017

Conversation

alexlyp
Copy link
Member

@alexlyp alexlyp commented May 23, 2017

Closes #757

// Parse vote version from extended bits. Note that once ExtendedBits
// are used for other information as well this will need to be updated
// to accomodate.
voteVersion := binary.LittleEndian.Uint32(w.VoteBits().ExtendedBits)
Copy link
Member

Choose a reason for hiding this comment

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

This should only pull out the version if the extended bits are long enough.

Also need to double check that the version is at the beginning of the bytes rather than the end. In wallet's case it only is including the version in the extended bits so I'm not sure which way is correct to pull them out. Need to consult dcrd here.

voteVersion := binary.LittleEndian.Uint32(w.VoteBits().ExtendedBits)
if voteVersion < blockHeader.StakeVersion {
log.Warnf("Old vote version detected (v%v), please update your "+
"wallet to the latest version.", voteVersion)
Copy link
Member

Choose a reason for hiding this comment

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

This message is currently misleading, it says there was an old vote version detected but prints the new version of the connected block.

We need to include both in the message too.

Copy link
Member Author

Choose a reason for hiding this comment

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

davecgh suggested to just say to update to latest, instead of specifying which version the network is on (which could confuse the user).

Also voteVersion is the version of the wallet not the connected block.

Copy link
Member

Choose a reason for hiding this comment

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

ooh, correct, I misread because this was parsing the bits out of the slice.

A better way to do this is to call voteVersion(w.chainParams) which will just return the vote version that the wallet writes to the slice, instead of needing to read it out of the slice.

@@ -293,6 +293,11 @@ func (w *Wallet) onBlockConnected(serializedBlockHeader []byte, transactions [][
w.NtfnServer.notifyMainChainTipChanged(chainTipChanges)
w.NtfnServer.sendAttachedBlockNotification()

if voteVersion(w.chainParams) < blockHeader.StakeVersion {
log.Warnf("Old vote version detected (v%v), please update your "+
"wallet to the latest version.", voteVersion)
Copy link
Member

Choose a reason for hiding this comment

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

needs to print the actual returned version not the function

@alexlyp alexlyp merged commit 56e5325 into decred:master Jun 6, 2017
@alexlyp alexlyp deleted the ayp_warn branch August 25, 2017 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants