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

V0.12.1.x govobj sync #864

Merged
merged 5 commits into from
Jun 8, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/flat-database.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,26 @@ class CFlatDB
{
int64_t nStart = GetTimeMillis();


// LOAD SERIALIZED FILE TO DETERMINE SAFETY OF SAVING INTO THAT FILE

/*


2016-06-02 21:23:55 dash-shutoff | Governance Objects: 1, Seen Budgets: 1, Seen Budget Votes: 0, Vote Count: 0
2016-06-02 21:23:55 dash-shutoff | Governance Objects: 1, Seen Budgets: 0, Seen Budget Votes: 0, Vote Count: 0
2016-06-02 21:29:17 dashd | Governance Objects: 1, Seen Budgets: 0, Seen Budget Votes: 0, Vote Count: 0
2016-06-02 21:29:17 dashd | CFlatDB - Governance Objects: 1, Seen Budgets: 0, Seen Budget Votes: 0, Vote Count: 0
2016-06-02 21:29:25 dash-shutoff | Governance Objects: 1, Seen Budgets: 0, Seen Budget Votes: 0, Vote Count: 0
2016-06-02 21:30:07 dash-shutoff | Governance Objects: 1, Seen Budgets: 1, Seen Budget Votes: 0, Vote Count: 0
2016-06-02 21:30:16 dashd | Governance Objects: 1, Seen Budgets: 1, Seen Budget Votes: 0, Vote Count: 0
2016-06-02 21:30:16 dashd | CFlatDB - Governance Objects: 1, Seen Budgets: 1, Seen Budget Votes: 0, Vote Count: 0


This fact can be demonstrated by adding a governance item, then stopping and starting the client.
With the code enabled, "Seen Budgets" will equal 0, whereas the object should have one entry.
*/

LogPrintf("Verifying %s format...\n", strFilename);
T tmpObjToLoad;
ReadResult readResult = Read(tmpObjToLoad, true);
Expand Down
4 changes: 2 additions & 2 deletions src/governance-vote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ CGovernanceVote::CGovernanceVote(CTxIn vinMasternodeIn, uint256 nParentHashIn, i

void CGovernanceVote::Relay()
{
CInv inv(MSG_BUDGET_VOTE, GetHash());
RelayInv(inv, MIN_BUDGET_PEER_PROTO_VERSION);
CInv inv(MSG_GOVERNANCE_VOTE, GetHash());
RelayInv(inv, MSG_GOVERNANCE_PEER_PROTO_VERSION);
}

bool CGovernanceVote::Sign(CKey& keyMasternode, CPubKey& pubKeyMasternode)
Expand Down
14 changes: 14 additions & 0 deletions src/governance-vote.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,20 @@ class CGovernanceVote
return ss.GetHash();
}

// GET HASH WITH DETERMINISTIC HASH OF PARENT-HASH/VOTE-TYPE
uint256 GetTypeHash()
{
// CALCULATE HOW TO STORE VOTE IN governance.mapVotes

CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
ss << vinMasternode;
ss << nParentHash;
ss << nVoteSignal;
ss << nVoteOutcome;
// -- timeless
return ss.GetHash();
}

uint256 GetParentHash(){
return nParentHash;
}
Expand Down
Loading