@@ -372,11 +372,20 @@ namespace
372372class MempoolUtxoHasher : public TransactionUtxoHasher
373373{
374374
375+ private:
376+
377+ /* * The active chain for getting the current chain tip. */
378+ const CChain& activeChain;
379+
375380public:
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
410419CTxMemPool::~CTxMemPool ()
0 commit comments