Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
domob1812 committed Nov 10, 2021
1 parent 890c662 commit 790d19e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion divi/src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ CClientUIInterface uiInterface;
bool fAddressIndex = false;
bool fSpentIndex = false;
const FeeAndPriorityCalculator& feeAndPriorityCalculator = FeeAndPriorityCalculator::instance();
CTxMemPool mempool(feeAndPriorityCalculator.getMinimumRelayFeeRate(), fAddressIndex, fSpentIndex);
CTxMemPool mempool(chainActive, feeAndPriorityCalculator.getMinimumRelayFeeRate(), fAddressIndex, fSpentIndex);

bool static InitError(const std::string& str)
{
Expand Down
2 changes: 1 addition & 1 deletion divi/src/test/mempool_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class MempoolTestFixture

MempoolTestFixture()
: fakeChain(1, 1500000000, 1),
testPool(CFeeRate(0), addressIndex, spentIndex),
testPool(*fakeChain.activeChain, CFeeRate(0), addressIndex, spentIndex),
coinsMemPool(nullptr, testPool), coins(&coinsMemPool)
{
std::unique_ptr<MockUtxoHasher> utxoHasher(new MockUtxoHasher());
Expand Down
15 changes: 12 additions & 3 deletions divi/src/txmempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,20 @@ namespace
class MempoolUtxoHasher : public TransactionUtxoHasher
{

private:

/** The active chain for getting the current chain tip. */
const CChain& activeChain;

public:

explicit MempoolUtxoHasher (const CChain& ca)
: activeChain(ca)
{}

OutputHash GetUtxoHash(const CTransaction& tx) const override
{
const ActivationState as(chainActive.Tip());
const ActivationState as(activeChain.Tip());
if (as.IsActive(Fork::SegwitLight))
return OutputHash(tx.GetBareTxid());
return OutputHash(tx.GetHash());
Expand All @@ -386,7 +395,7 @@ class MempoolUtxoHasher : public TransactionUtxoHasher

} // anonymous namespace

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

utxoHasher.reset(new MempoolUtxoHasher());
utxoHasher.reset(new MempoolUtxoHasher(activeChain));
}

CTxMemPool::~CTxMemPool()
Expand Down
2 changes: 1 addition & 1 deletion divi/src/txmempool.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class CTxMemPool
std::map<uint256, CTxMemPoolEntry> mapTx;
std::map<COutPoint, CInPoint> mapNextTx;

explicit CTxMemPool(const CFeeRate& _minRelayFee,
explicit CTxMemPool(const CChain& activeChain, const CFeeRate& _minRelayFee,
const bool& addressIndex, const bool& spentIndex);
~CTxMemPool();

Expand Down

0 comments on commit 790d19e

Please sign in to comment.