Skip to content

Commit

Permalink
Backporting fixes for CMasternodeMan::CheckAndRemove and smartfee (…
Browse files Browse the repository at this point in the history
…+test)

Closes #738
  • Loading branch information
UdjinM6 authored and schinzelh committed Mar 16, 2016
1 parent fbd4319 commit 6cfe5bf
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions qa/rpc-tests/smartfees.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def setup_network(self):
def run_test(self):
# Prime the memory pool with pairs of transactions
# (high-priority, random fee and zero-priority, random fee)
min_fee = Decimal("0.001")
min_fee = Decimal("0.00010000")
fees_per_kb = [];
for i in range(12):
(txid, txhex, fee) = random_zeropri_transaction(self.nodes, Decimal("1.1"),
Expand All @@ -58,7 +58,7 @@ def run_test(self):
print("Fee estimates, super-stingy miner: "+str([str(e) for e in all_estimates]))

# Estimates should be within the bounds of what transactions fees actually were:
delta = 1.0e-6 # account for rounding error
delta = 1.0e-5 # account for rounding error
for e in filter(lambda x: x >= 0, all_estimates):
if float(e)+delta < min(fees_per_kb) or float(e)-delta > max(fees_per_kb):
raise AssertionError("Estimated fee (%f) out of range (%f,%f)"%(float(e), min_fee_kb, max_fee_kb))
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,7 @@ int64_t GetBlockValue(int nBits, int nHeight, const CAmount& nFees)
double dDiff = (double)0x0000ffff / (double)(nBits & 0x00ffffff);

/* fixed bug caused diff to not be correctly calculated */
if(nHeight > 4500 || Params().NetworkID() == CBaseChainParams::TESTNET) dDiff = ConvertBitsToDouble(nBits);
if(nHeight > 4500 || Params().NetworkID() != CBaseChainParams::MAIN) dDiff = ConvertBitsToDouble(nBits);

int64_t nSubsidy = 0;
if(nHeight >= 5465) {
Expand Down
23 changes: 12 additions & 11 deletions src/masternodeman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,17 +324,18 @@ void CMasternodeMan::CheckAndRemove(bool forceExpiredRemoval)
}
}

// remove expired mapSeenMasternodeBroadcast
map<uint256, CMasternodeBroadcast>::iterator it3 = mapSeenMasternodeBroadcast.begin();
while(it3 != mapSeenMasternodeBroadcast.end()){
if((*it3).second.lastPing.sigTime < GetTime()-(MASTERNODE_REMOVAL_SECONDS*2)){
mapSeenMasternodeBroadcast.erase(it3++);
masternodeSync.mapSeenSyncMNB.erase((*it3).second.GetHash());
} else {
++it3;
}
}

// remove expired mapSeenMasternodeBroadcast
map<uint256, CMasternodeBroadcast>::iterator it3 = mapSeenMasternodeBroadcast.begin();
while(it3 != mapSeenMasternodeBroadcast.end()){
if((*it3).second.lastPing.sigTime < GetTime() - MASTERNODE_REMOVAL_SECONDS*2){
LogPrint("masternode", "CMasternodeMan::CheckAndRemove - Removing expired Masternode broadcast %s\n", (*it3).second.GetHash().ToString());
masternodeSync.mapSeenSyncMNB.erase((*it3).second.GetHash());
mapSeenMasternodeBroadcast.erase(it3++);
} else {
++it3;
}
}

// remove expired mapSeenMasternodePing
map<uint256, CMasternodePing>::iterator it4 = mapSeenMasternodePing.begin();
while(it4 != mapSeenMasternodePing.end()){
Expand Down
2 changes: 1 addition & 1 deletion src/txmempool.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CAutoFile;

inline double AllowFreeThreshold()
{
return COIN * 576 / 250;
return COIN * 144 / 250;
}

inline bool AllowFree(double dPriority)
Expand Down

0 comments on commit 6cfe5bf

Please sign in to comment.