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

Backport bugfixes for CMasternodeMan::CheckAndRemove and smartfee (+test) #738

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
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 qa/rpc-tests/test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class BitcoinTestFramework(object):
def run_test(self):
for node in self.nodes:
assert_equal(node.getblockcount(), 200)
assert_equal(node.getbalance(), 25*50)
assert_equal(node.getbalance(), 25*500)

def add_options(self, parser):
pass
Expand Down
6 changes: 3 additions & 3 deletions qa/rpc-tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ def initialize_chain(test_dir):
# Create a 200-block-long chain; each of the 4 nodes
# gets 25 mature blocks and 25 immature.
# blocks are created with timestamps 10 minutes apart, starting
# at 1 Jan 2014
block_time = 1388534400
# at 2014-12-04T17:15:37+00:00 in ISO 8601
block_time = 1417713337
for i in range(2):
for peer in range(4):
for j in range(25):
set_node_times(rpcs, block_time)
rpcs[peer].setgenerate(True, 1)
block_time += 10*60
block_time += 150
# Must sync before next peer starts generating blocks
sync_blocks(rpcs)

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