rename nEpochStart variable and adjust comments (#1915)
* rename nEpochStart variable and adjust comments * rename GetBlockStart() -> GetBlockHeight() * change var name to nBlockHeight
This commit is contained in:
parent
8ea1bd0f55
commit
354aac8d1c
@ -196,7 +196,7 @@ void CGovernanceTriggerManager::CleanAndRemove()
|
|||||||
case SEEN_OBJECT_IS_VALID:
|
case SEEN_OBJECT_IS_VALID:
|
||||||
case SEEN_OBJECT_EXECUTED:
|
case SEEN_OBJECT_EXECUTED:
|
||||||
{
|
{
|
||||||
int nTriggerBlock = pSuperblock->GetBlockStart();
|
int nTriggerBlock = pSuperblock->GetBlockHeight();
|
||||||
// Rough approximation: a cycle of superblock ++
|
// Rough approximation: a cycle of superblock ++
|
||||||
int nExpirationBlock = nTriggerBlock + GOVERNANCE_TRIGGER_EXPIRATION_BLOCKS;
|
int nExpirationBlock = nTriggerBlock + GOVERNANCE_TRIGGER_EXPIRATION_BLOCKS;
|
||||||
LogPrint("gobject", "CGovernanceTriggerManager::CleanAndRemove -- nTriggerBlock = %d, nExpirationBlock = %d\n", nTriggerBlock, nExpirationBlock);
|
LogPrint("gobject", "CGovernanceTriggerManager::CleanAndRemove -- nTriggerBlock = %d, nExpirationBlock = %d\n", nTriggerBlock, nExpirationBlock);
|
||||||
@ -312,13 +312,13 @@ bool CSuperblockManager::IsSuperblockTriggered(int nBlockHeight)
|
|||||||
|
|
||||||
// note : 12.1 - is epoch calculation correct?
|
// note : 12.1 - is epoch calculation correct?
|
||||||
|
|
||||||
if(nBlockHeight != pSuperblock->GetBlockStart()) {
|
if(nBlockHeight != pSuperblock->GetBlockHeight()) {
|
||||||
LogPrint("gobject", "CSuperblockManager::IsSuperblockTriggered -- block height doesn't match nBlockHeight = %d, blockStart = %d, continuing\n",
|
LogPrint("gobject", "CSuperblockManager::IsSuperblockTriggered -- block height doesn't match nBlockHeight = %d, blockStart = %d, continuing\n",
|
||||||
nBlockHeight,
|
nBlockHeight,
|
||||||
pSuperblock->GetBlockStart());
|
pSuperblock->GetBlockHeight());
|
||||||
DBG( cout << "IsSuperblockTriggered Not the target block, continuing"
|
DBG( cout << "IsSuperblockTriggered Not the target block, continuing"
|
||||||
<< ", nBlockHeight = " << nBlockHeight
|
<< ", nBlockHeight = " << nBlockHeight
|
||||||
<< ", superblock->GetBlockStart() = " << pSuperblock->GetBlockStart()
|
<< ", superblock->GetBlockHeight() = " << pSuperblock->GetBlockHeight()
|
||||||
<< endl; );
|
<< endl; );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -365,7 +365,7 @@ bool CSuperblockManager::GetBestSuperblock(CSuperblock_sptr& pSuperblockRet, int
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(nBlockHeight != pSuperblock->GetBlockStart()) {
|
if(nBlockHeight != pSuperblock->GetBlockHeight()) {
|
||||||
DBG( cout << "GetBestSuperblock Not the target block, continuing" << endl; );
|
DBG( cout << "GetBestSuperblock Not the target block, continuing" << endl; );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -463,7 +463,7 @@ bool CSuperblockManager::IsValid(const CTransaction& txNew, int nBlockHeight, CA
|
|||||||
CSuperblock::
|
CSuperblock::
|
||||||
CSuperblock()
|
CSuperblock()
|
||||||
: nGovObjHash(),
|
: nGovObjHash(),
|
||||||
nEpochStart(0),
|
nBlockHeight(0),
|
||||||
nStatus(SEEN_OBJECT_UNKNOWN),
|
nStatus(SEEN_OBJECT_UNKNOWN),
|
||||||
vecPayments()
|
vecPayments()
|
||||||
{}
|
{}
|
||||||
@ -471,7 +471,7 @@ CSuperblock()
|
|||||||
CSuperblock::
|
CSuperblock::
|
||||||
CSuperblock(uint256& nHash)
|
CSuperblock(uint256& nHash)
|
||||||
: nGovObjHash(nHash),
|
: nGovObjHash(nHash),
|
||||||
nEpochStart(0),
|
nBlockHeight(0),
|
||||||
nStatus(SEEN_OBJECT_UNKNOWN),
|
nStatus(SEEN_OBJECT_UNKNOWN),
|
||||||
vecPayments()
|
vecPayments()
|
||||||
{
|
{
|
||||||
@ -496,16 +496,16 @@ CSuperblock(uint256& nHash)
|
|||||||
|
|
||||||
UniValue obj = pGovObj->GetJSONObject();
|
UniValue obj = pGovObj->GetJSONObject();
|
||||||
|
|
||||||
// FIRST WE GET THE START EPOCH, THE DATE WHICH THE PAYMENT SHALL OCCUR
|
// FIRST WE GET THE START HEIGHT, THE BLOCK HEIGHT AT WHICH THE PAYMENT SHALL OCCUR
|
||||||
nEpochStart = obj["event_block_height"].get_int();
|
nBlockHeight = obj["event_block_height"].get_int();
|
||||||
|
|
||||||
// NEXT WE GET THE PAYMENT INFORMATION AND RECONSTRUCT THE PAYMENT VECTOR
|
// NEXT WE GET THE PAYMENT INFORMATION AND RECONSTRUCT THE PAYMENT VECTOR
|
||||||
std::string strAddresses = obj["payment_addresses"].get_str();
|
std::string strAddresses = obj["payment_addresses"].get_str();
|
||||||
std::string strAmounts = obj["payment_amounts"].get_str();
|
std::string strAmounts = obj["payment_amounts"].get_str();
|
||||||
ParsePaymentSchedule(strAddresses, strAmounts);
|
ParsePaymentSchedule(strAddresses, strAmounts);
|
||||||
|
|
||||||
LogPrint("gobject", "CSuperblock -- nEpochStart = %d, strAddresses = %s, strAmounts = %s, vecPayments.size() = %d\n",
|
LogPrint("gobject", "CSuperblock -- nBlockHeight = %d, strAddresses = %s, strAmounts = %s, vecPayments.size() = %d\n",
|
||||||
nEpochStart, strAddresses, strAmounts, vecPayments.size());
|
nBlockHeight, strAddresses, strAmounts, vecPayments.size());
|
||||||
|
|
||||||
DBG( cout << "CSuperblock Constructor End" << endl; );
|
DBG( cout << "CSuperblock Constructor End" << endl; );
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ class CSuperblock : public CGovernanceObject
|
|||||||
private:
|
private:
|
||||||
uint256 nGovObjHash;
|
uint256 nGovObjHash;
|
||||||
|
|
||||||
int nEpochStart;
|
int nBlockHeight;
|
||||||
int nStatus;
|
int nStatus;
|
||||||
std::vector<CGovernancePayment> vecPayments;
|
std::vector<CGovernancePayment> vecPayments;
|
||||||
|
|
||||||
@ -177,26 +177,9 @@ public:
|
|||||||
return pObj;
|
return pObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetBlockStart()
|
int GetBlockHeight()
|
||||||
{
|
{
|
||||||
/* // 12.1 TRIGGER EXECUTION */
|
return nBlockHeight;
|
||||||
/* // NOTE : Is this over complicated? */
|
|
||||||
|
|
||||||
/* //int nRet = 0; */
|
|
||||||
/* int nTipEpoch = 0; */
|
|
||||||
/* int nTipBlock = chainActive.Tip()->nHeight+1; */
|
|
||||||
|
|
||||||
/* // GET TIP EPOCK / BLOCK */
|
|
||||||
|
|
||||||
/* // typically it should be more than the current time */
|
|
||||||
/* int nDiff = nEpochStart - nTipEpoch; */
|
|
||||||
/* int nBlockDiff = nDiff / (2.6*60); */
|
|
||||||
|
|
||||||
/* // calculate predicted block height */
|
|
||||||
/* int nMod = (nTipBlock + nBlockDiff) % Params().GetConsensus().nSuperblockCycle; */
|
|
||||||
|
|
||||||
/* return (nTipBlock + nBlockDiff)-nMod; */
|
|
||||||
return nEpochStart;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CountPayments() { return (int)vecPayments.size(); }
|
int CountPayments() { return (int)vecPayments.size(); }
|
||||||
|
Loading…
Reference in New Issue
Block a user