Merge pull request #360 from UdjinM6/v0.12.0.x_fix_buffer_overflow
V0.12.0.x SecondsSincePayment
This commit is contained in:
commit
4229e8a2c9
@ -245,6 +245,19 @@ void CMasternode::Check()
|
|||||||
activeState = MASTERNODE_ENABLED; // OK
|
activeState = MASTERNODE_ENABLED; // OK
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t CMasternode::SecondsSincePayment() {
|
||||||
|
int64_t sec = (GetAdjustedTime() - nLastPaid);
|
||||||
|
int64_t month = 60*60*24*30;
|
||||||
|
if(sec < month) return sec; //if it's less than 30 days, give seconds
|
||||||
|
|
||||||
|
CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
|
||||||
|
ss << vin;
|
||||||
|
ss << sigTime;
|
||||||
|
uint256 hash = ss.GetHash();
|
||||||
|
|
||||||
|
// return some deterministic value for unknown/unpaid but force it to be more than 30 days old
|
||||||
|
return month + hash.GetCompact(false);
|
||||||
|
}
|
||||||
|
|
||||||
CMasternodeBroadcast::CMasternodeBroadcast()
|
CMasternodeBroadcast::CMasternodeBroadcast()
|
||||||
{
|
{
|
||||||
|
@ -163,19 +163,7 @@ public:
|
|||||||
READWRITE(nVotedTimes);
|
READWRITE(nVotedTimes);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t SecondsSincePayment()
|
int64_t SecondsSincePayment();
|
||||||
{
|
|
||||||
int64_t sec = (GetAdjustedTime() - nLastPaid);
|
|
||||||
if(sec < 60*60*24*30) return sec; //if it's less than 30 days, give seconds
|
|
||||||
|
|
||||||
CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
|
|
||||||
ss << vin;
|
|
||||||
ss << sigTime;
|
|
||||||
uint256 hash = ss.GetHash();
|
|
||||||
|
|
||||||
memcpy(&sec, &hash, 64);
|
|
||||||
return sec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UpdateFromNewBroadcast(CMasternodeBroadcast& mnb);
|
void UpdateFromNewBroadcast(CMasternodeBroadcast& mnb);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user