Skip to content

Commit

Permalink
Add feedelta to TxMempoolInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
sipa authored and furszy committed Jan 18, 2021
1 parent 9979f3d commit 6bbc6a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/txmempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,10 @@ void CTxMemPool::queryHashes(std::vector<uint256>& vtxid)
}
}

static TxMempoolInfo GetInfo(CTxMemPool::indexed_transaction_set::const_iterator it) {
return TxMempoolInfo{it->GetSharedTx(), it->GetTime(), CFeeRate(it->GetFee(), it->GetTxSize()), it->GetModifiedFee() - it->GetFee()};
}

std::vector<TxMempoolInfo> CTxMemPool::infoAll() const
{
LOCK(cs);
Expand All @@ -882,7 +886,7 @@ std::vector<TxMempoolInfo> CTxMemPool::infoAll() const
std::vector<TxMempoolInfo> ret;
ret.reserve(mapTx.size());
for (auto it : iters) {
ret.emplace_back(TxMempoolInfo{it->GetSharedTx(), it->GetTime(), CFeeRate(it->GetFee(), it->GetTxSize())});
ret.emplace_back(GetInfo(it));
}

return ret;
Expand Down Expand Up @@ -912,7 +916,7 @@ TxMempoolInfo CTxMemPool::info(const uint256& hash) const
indexed_transaction_set::const_iterator i = mapTx.find(hash);
if (i == mapTx.end())
return TxMempoolInfo();
return TxMempoolInfo{i->GetSharedTx(), i->GetTime(), CFeeRate(i->GetFee(), i->GetTxSize())};
return GetInfo(i);
}

CFeeRate CTxMemPool::estimateFee(int nBlocks) const
Expand Down
3 changes: 3 additions & 0 deletions src/txmempool.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,9 @@ struct TxMempoolInfo

/** Feerate of the transaction. */
CFeeRate feeRate;

/** The fee delta. */
int64_t nFeeDelta;
};

/**
Expand Down

0 comments on commit 6bbc6a9

Please sign in to comment.