-
Notifications
You must be signed in to change notification settings - Fork 154
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
Conversation
wallet/chainntfns.go
Outdated
// 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) |
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 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.
wallet/chainntfns.go
Outdated
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) |
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 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.
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.
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.
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.
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.
wallet/chainntfns.go
Outdated
@@ -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) |
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.
needs to print the actual returned version not the function
Closes #757