-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Implement a way to sync only needed winners #1028
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,20 +40,36 @@ std::string GetRequiredPaymentsString(int nBlockHeight); | |
|
|
||
| class CMasternodePayee | ||
| { | ||
| public: | ||
| private: | ||
| CScript scriptPubKey; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't vin (ie. COutPoint) be used here to insure uniqueness ?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, that would be better but we only have |
||
| int nVotes; | ||
| std::vector<uint256> vecVoteHashes; | ||
|
|
||
| CMasternodePayee() : scriptPubKey(CScript()), nVotes(0) {} | ||
| CMasternodePayee(CScript payee, int nVotesIn) : scriptPubKey(payee), nVotes(nVotesIn) {} | ||
| public: | ||
| CMasternodePayee() : | ||
| scriptPubKey(), | ||
| vecVoteHashes() | ||
| {} | ||
|
|
||
| CMasternodePayee(CScript payee, uint256 hashIn) : | ||
| scriptPubKey(payee), | ||
| vecVoteHashes() | ||
| { | ||
| vecVoteHashes.push_back(hashIn); | ||
| } | ||
|
|
||
| ADD_SERIALIZE_METHODS; | ||
|
|
||
| template <typename Stream, typename Operation> | ||
| inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { | ||
| READWRITE(*(CScriptBase*)(&scriptPubKey)); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know you didn't change this but this looks weird. Why all the casting ? Shouldn't
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see bitcoin#6914 |
||
| READWRITE(nVotes); | ||
| } | ||
| READWRITE(vecVoteHashes); | ||
| } | ||
|
|
||
| CScript GetPayee() { return scriptPubKey; } | ||
|
|
||
| void AddVoteHash(uint256 hashIn) { vecVoteHashes.push_back(hashIn); } | ||
| std::vector<uint256> GetVoteHashes() { return vecVoteHashes; } | ||
| int GetVoteCount() { return vecVoteHashes.size(); } | ||
| }; | ||
|
|
||
| // Keep track of votes for payees from masternodes | ||
|
|
@@ -169,6 +185,7 @@ class CMasternodePayments | |
| bool ProcessBlock(int nBlockHeight); | ||
|
|
||
| void Sync(CNode* node, int nCountNeeded); | ||
| void RequestLowDataPaymentBlocks(CNode* pnode); | ||
| void CheckAndRemove(); | ||
|
|
||
| bool GetBlockPayee(int nBlockHeight, CScript& payee); | ||
|
|
||
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.
It looks like the break here will make nTotalVotes innacurate
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.
yep, but it will not be used if fFound is true anyway