Skip to content

Commit 2cc1372

Browse files
committed
Merge pull request #5159
b649e03 Create new BlockPolicyEstimator for fee estimates (Alex Morcos)
2 parents 4848218 + b649e03 commit 2cc1372

File tree

10 files changed

+1267
-424
lines changed

10 files changed

+1267
-424
lines changed

qa/rpc-tests/smartfees.py

Lines changed: 224 additions & 57 deletions
Large diffs are not rendered by default.

qa/rpc-tests/util.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ def check_json_precision():
3333
if satoshis != 2000000000000003:
3434
raise RuntimeError("JSON encode/decode loses precision")
3535

36-
def sync_blocks(rpc_connections):
36+
def sync_blocks(rpc_connections, wait=1):
3737
"""
3838
Wait until everybody has the same block count
3939
"""
4040
while True:
4141
counts = [ x.getblockcount() for x in rpc_connections ]
4242
if counts == [ counts[0] ]*len(counts):
4343
break
44-
time.sleep(1)
44+
time.sleep(wait)
4545

46-
def sync_mempools(rpc_connections):
46+
def sync_mempools(rpc_connections, wait=1):
4747
"""
4848
Wait until everybody has the same transactions in their memory
4949
pools
@@ -56,7 +56,7 @@ def sync_mempools(rpc_connections):
5656
num_match = num_match+1
5757
if num_match == len(rpc_connections):
5858
break
59-
time.sleep(1)
59+
time.sleep(wait)
6060

6161
bitcoind_processes = {}
6262

src/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ BITCOIN_CORE_H = \
106106
netbase.h \
107107
net.h \
108108
noui.h \
109+
policy/fees.h \
109110
pow.h \
110111
primitives/block.h \
111112
primitives/transaction.h \
@@ -182,6 +183,7 @@ libbitcoin_server_a_SOURCES = \
182183
miner.cpp \
183184
net.cpp \
184185
noui.cpp \
186+
policy/fees.cpp \
185187
pow.cpp \
186188
rest.cpp \
187189
rpcblockchain.cpp \

src/Makefile.test.include

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ BITCOIN_TESTS =\
5757
test/multisig_tests.cpp \
5858
test/netbase_tests.cpp \
5959
test/pmt_tests.cpp \
60+
test/policyestimator_tests.cpp \
6061
test/pow_tests.cpp \
6162
test/rpc_tests.cpp \
6263
test/sanity_tests.cpp \

src/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
987987
CAmount nFees = nValueIn-nValueOut;
988988
double dPriority = view.GetPriority(tx, chainActive.Height());
989989

990-
CTxMemPoolEntry entry(tx, nFees, GetTime(), dPriority, chainActive.Height());
990+
CTxMemPoolEntry entry(tx, nFees, GetTime(), dPriority, chainActive.Height(), mempool.HasNoInputsOf(tx));
991991
unsigned int nSize = entry.GetTxSize();
992992

993993
// Don't accept it if it can't get into a block
@@ -1053,7 +1053,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
10531053
}
10541054

10551055
// Store transaction in memory
1056-
pool.addUnchecked(hash, entry);
1056+
pool.addUnchecked(hash, entry, !IsInitialBlockDownload());
10571057
}
10581058

10591059
SyncWithWallets(tx, NULL);
@@ -2087,7 +2087,7 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
20872087
LogPrint("bench", " - Writing chainstate: %.2fms [%.2fs]\n", (nTime5 - nTime4) * 0.001, nTimeChainState * 0.000001);
20882088
// Remove conflicting transactions from the mempool.
20892089
list<CTransaction> txConflicted;
2090-
mempool.removeForBlock(pblock->vtx, pindexNew->nHeight, txConflicted);
2090+
mempool.removeForBlock(pblock->vtx, pindexNew->nHeight, txConflicted, !IsInitialBlockDownload());
20912091
mempool.check(pcoinsTip);
20922092
// Update chainActive & related variables.
20932093
UpdateTip(pindexNew);

0 commit comments

Comments
 (0)