Skip to content

Commit

Permalink
introduced spork 12
Browse files Browse the repository at this point in the history
  • Loading branch information
bitgdev committed Aug 14, 2018
1 parent 6f1e309 commit 5bc000e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/spork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ void ProcessSpork(CNode* pfrom, std::string& strCommand, CDataStream& vRecv)
mapSporksActive[spork.nSporkID] = spork;
sporkManager.Relay(spork);

// does a task if needed
ExecuteSpork(spork.nSporkID, spork.nValue);

// BITG: add to spork database.
pSporkDB->WriteSpork(spork.nSporkID, spork);
}
Expand Down Expand Up @@ -146,6 +149,14 @@ bool IsSporkActive(int nSporkID)
return r < GetTime();
}

void ExecuteSpork(int nSporkID, int nValue)
{
if (nSporkID == SPORK_12_RECONSIDER_BLOCKS && nValue > 0) {
LogPrintf("Spork::ExecuteSpork -- Reconsider Last %d Blocks\n", nValue);
ReprocessBlocks(nValue);
}
}

void ReprocessBlocks(int nBlocks)
{
std::map<uint256, int64_t>::iterator it = mapRejectedBlocks.begin();
Expand Down
1 change: 1 addition & 0 deletions src/spork.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ void LoadSporksFromDB();
void ProcessSpork(CNode* pfrom, std::string& strCommand, CDataStream& vRecv);
int64_t GetSporkValue(int nSporkID);
bool IsSporkActive(int nSporkID);
void ExecuteSpork(int nSporkID, int nValue);
void ReprocessBlocks(int nBlocks);

//
Expand Down

0 comments on commit 5bc000e

Please sign in to comment.