rpc: Calculate ancestor data from scratch for mempool rpc calls

This commit is contained in:
Suhas Daftuar
2023-09-28 15:07:05 -04:00
parent 7961496dda
commit 9fbe0a4ac2

View File

@@ -290,20 +290,22 @@ static void entryToJSON(const CTxMemPool& pool, UniValue& info, const CTxMemPool
{
AssertLockHeld(pool.cs);
auto [ancestor_count, ancestor_size, ancestor_fees] = pool.CalculateAncestorData(e);
info.pushKV("vsize", (int)e.GetTxSize());
info.pushKV("weight", (int)e.GetTxWeight());
info.pushKV("time", count_seconds(e.GetTime()));
info.pushKV("height", (int)e.GetHeight());
info.pushKV("descendantcount", e.GetCountWithDescendants());
info.pushKV("descendantsize", e.GetSizeWithDescendants());
info.pushKV("ancestorcount", e.GetCountWithAncestors());
info.pushKV("ancestorsize", e.GetSizeWithAncestors());
info.pushKV("ancestorcount", ancestor_count);
info.pushKV("ancestorsize", ancestor_size);
info.pushKV("wtxid", e.GetTx().GetWitnessHash().ToString());
UniValue fees(UniValue::VOBJ);
fees.pushKV("base", ValueFromAmount(e.GetFee()));
fees.pushKV("modified", ValueFromAmount(e.GetModifiedFee()));
fees.pushKV("ancestor", ValueFromAmount(e.GetModFeesWithAncestors()));
fees.pushKV("ancestor", ValueFromAmount(ancestor_fees));
fees.pushKV("descendant", ValueFromAmount(e.GetModFeesWithDescendants()));
info.pushKV("fees", std::move(fees));