Skip to content

Commit 790d19e

Browse files
committed
fixup
1 parent 890c662 commit 790d19e

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

divi/src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ CClientUIInterface uiInterface;
116116
bool fAddressIndex = false;
117117
bool fSpentIndex = false;
118118
const FeeAndPriorityCalculator& feeAndPriorityCalculator = FeeAndPriorityCalculator::instance();
119-
CTxMemPool mempool(feeAndPriorityCalculator.getMinimumRelayFeeRate(), fAddressIndex, fSpentIndex);
119+
CTxMemPool mempool(chainActive, feeAndPriorityCalculator.getMinimumRelayFeeRate(), fAddressIndex, fSpentIndex);
120120

121121
bool static InitError(const std::string& str)
122122
{

divi/src/test/mempool_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class MempoolTestFixture
4444

4545
MempoolTestFixture()
4646
: fakeChain(1, 1500000000, 1),
47-
testPool(CFeeRate(0), addressIndex, spentIndex),
47+
testPool(*fakeChain.activeChain, CFeeRate(0), addressIndex, spentIndex),
4848
coinsMemPool(nullptr, testPool), coins(&coinsMemPool)
4949
{
5050
std::unique_ptr<MockUtxoHasher> utxoHasher(new MockUtxoHasher());

divi/src/txmempool.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,11 +372,20 @@ namespace
372372
class MempoolUtxoHasher : public TransactionUtxoHasher
373373
{
374374

375+
private:
376+
377+
/** The active chain for getting the current chain tip. */
378+
const CChain& activeChain;
379+
375380
public:
376381

382+
explicit MempoolUtxoHasher (const CChain& ca)
383+
: activeChain(ca)
384+
{}
385+
377386
OutputHash GetUtxoHash(const CTransaction& tx) const override
378387
{
379-
const ActivationState as(chainActive.Tip());
388+
const ActivationState as(activeChain.Tip());
380389
if (as.IsActive(Fork::SegwitLight))
381390
return OutputHash(tx.GetBareTxid());
382391
return OutputHash(tx.GetHash());
@@ -386,7 +395,7 @@ class MempoolUtxoHasher : public TransactionUtxoHasher
386395

387396
} // anonymous namespace
388397

389-
CTxMemPool::CTxMemPool(const CFeeRate& _minRelayFee,
398+
CTxMemPool::CTxMemPool(const CChain& activeChain, const CFeeRate& _minRelayFee,
390399
const bool& addressIndex, const bool& spentIndex)
391400
: nTransactionsUpdated(0),
392401
minRelayFee(_minRelayFee),
@@ -404,7 +413,7 @@ CTxMemPool::CTxMemPool(const CFeeRate& _minRelayFee,
404413
// than an hour or three to confirm are highly variable.
405414
minerPolicyEstimator = new CMinerPolicyEstimator(25);
406415

407-
utxoHasher.reset(new MempoolUtxoHasher());
416+
utxoHasher.reset(new MempoolUtxoHasher(activeChain));
408417
}
409418

410419
CTxMemPool::~CTxMemPool()

divi/src/txmempool.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class CTxMemPool
145145
std::map<uint256, CTxMemPoolEntry> mapTx;
146146
std::map<COutPoint, CInPoint> mapNextTx;
147147

148-
explicit CTxMemPool(const CFeeRate& _minRelayFee,
148+
explicit CTxMemPool(const CChain& activeChain, const CFeeRate& _minRelayFee,
149149
const bool& addressIndex, const bool& spentIndex);
150150
~CTxMemPool();
151151

0 commit comments

Comments
 (0)