Merge #6395: refactor: drop unused InstantSendManager from blockheaderToJSON

3a48c7f503 refactor: drop unused InstantSendManager from blockheaderToJSON (Konstantin Akimov)

Pull request description:

  ## What was done?
  Trivial refactoring - see a commit

  ## How Has This Been Tested?
  Run unit and functional tests

  ## Breaking Changes
  N/A

  ## Checklist:
  - [x] I have performed a self-review of my own code
  - [x] I have commented my code, particularly in hard-to-understand areas
  - [x] I have added or updated relevant unit/integration/functional/e2e tests
  - [x] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)

ACKs for top commit:
  UdjinM6:
    utACK 3a48c7f503
  PastaPastaPasta:
    utACK 3a48c7f503

Tree-SHA512: d33fbc504f8be076bd89a6651b38c27323b371009c2839dd7125ac0b75d5bc89344e247b13e19af1ddc57f80cb30693673a54311afd41cadd0b76a471d96712f
This commit is contained in:
pasta 2024-11-16 13:55:53 -06:00
commit 495171b2e7
No known key found for this signature in database
GPG Key ID: E2F3D7916E722D38
3 changed files with 6 additions and 6 deletions

View File

@ -248,7 +248,7 @@ static bool rest_headers(const CoreContext& context,
case RetFormat::JSON: { case RetFormat::JSON: {
UniValue jsonHeaders(UniValue::VARR); UniValue jsonHeaders(UniValue::VARR);
for (const CBlockIndex *pindex : headers) { for (const CBlockIndex *pindex : headers) {
jsonHeaders.push_back(blockheaderToJSON(tip, pindex, *llmq::chainLocksHandler, *llmq::quorumInstantSendManager)); jsonHeaders.push_back(blockheaderToJSON(tip, pindex, *llmq::chainLocksHandler));
} }
std::string strJSON = jsonHeaders.write() + "\n"; std::string strJSON = jsonHeaders.write() + "\n";
req->WriteHeader("Content-Type", "application/json"); req->WriteHeader("Content-Type", "application/json");

View File

@ -127,7 +127,7 @@ static const CBlockIndex* ParseHashOrHeight(const UniValue& param, ChainstateMan
} }
} }
UniValue blockheaderToJSON(const CBlockIndex* tip, const CBlockIndex* blockindex, llmq::CChainLocksHandler& clhandler, llmq::CInstantSendManager& isman) UniValue blockheaderToJSON(const CBlockIndex* tip, const CBlockIndex* blockindex, llmq::CChainLocksHandler& clhandler)
{ {
// Serialize passed information without accessing chain state of the active chain! // Serialize passed information without accessing chain state of the active chain!
AssertLockNotHeld(cs_main); // For performance reasons AssertLockNotHeld(cs_main); // For performance reasons
@ -161,7 +161,7 @@ UniValue blockheaderToJSON(const CBlockIndex* tip, const CBlockIndex* blockindex
UniValue blockToJSON(BlockManager& blockman, const CBlock& block, const CBlockIndex* tip, const CBlockIndex* blockindex, llmq::CChainLocksHandler& clhandler, llmq::CInstantSendManager& isman, bool txDetails) UniValue blockToJSON(BlockManager& blockman, const CBlock& block, const CBlockIndex* tip, const CBlockIndex* blockindex, llmq::CChainLocksHandler& clhandler, llmq::CInstantSendManager& isman, bool txDetails)
{ {
UniValue result = blockheaderToJSON(tip, blockindex, clhandler, isman); UniValue result = blockheaderToJSON(tip, blockindex, clhandler);
result.pushKV("size", (int)::GetSerializeSize(block, PROTOCOL_VERSION)); result.pushKV("size", (int)::GetSerializeSize(block, PROTOCOL_VERSION));
UniValue txs(UniValue::VARR); UniValue txs(UniValue::VARR);
@ -986,7 +986,7 @@ static RPCHelpMan getblockheader()
} }
LLMQContext& llmq_ctx = EnsureLLMQContext(node); LLMQContext& llmq_ctx = EnsureLLMQContext(node);
return blockheaderToJSON(tip, pblockindex, *llmq_ctx.clhandler, *llmq_ctx.isman); return blockheaderToJSON(tip, pblockindex, *llmq_ctx.clhandler);
}, },
}; };
} }
@ -1087,7 +1087,7 @@ static RPCHelpMan getblockheaders()
LLMQContext& llmq_ctx = EnsureLLMQContext(node); LLMQContext& llmq_ctx = EnsureLLMQContext(node);
for (; pblockindex; pblockindex = active_chain.Next(pblockindex)) for (; pblockindex; pblockindex = active_chain.Next(pblockindex))
{ {
arrHeaders.push_back(blockheaderToJSON(tip, pblockindex, *llmq_ctx.clhandler, *llmq_ctx.isman)); arrHeaders.push_back(blockheaderToJSON(tip, pblockindex, *llmq_ctx.clhandler));
if (--nCount <= 0) if (--nCount <= 0)
break; break;
} }

View File

@ -50,7 +50,7 @@ UniValue MempoolInfoToJSON(const CTxMemPool& pool, llmq::CInstantSendManager& is
UniValue MempoolToJSON(const CTxMemPool& pool, llmq::CInstantSendManager* isman, bool verbose = false, bool include_mempool_sequence = false); UniValue MempoolToJSON(const CTxMemPool& pool, llmq::CInstantSendManager* isman, bool verbose = false, bool include_mempool_sequence = false);
/** Block header to JSON */ /** Block header to JSON */
UniValue blockheaderToJSON(const CBlockIndex* tip, const CBlockIndex* blockindex, llmq::CChainLocksHandler& clhandler, llmq::CInstantSendManager& isman) LOCKS_EXCLUDED(cs_main); UniValue blockheaderToJSON(const CBlockIndex* tip, const CBlockIndex* blockindex, llmq::CChainLocksHandler& clhandler) LOCKS_EXCLUDED(cs_main);
/** Used by getblockstats to get feerates at different percentiles by weight */ /** Used by getblockstats to get feerates at different percentiles by weight */
void CalculatePercentilesBySize(CAmount result[NUM_GETBLOCKSTATS_PERCENTILES], std::vector<std::pair<CAmount, int64_t>>& scores, int64_t total_size); void CalculatePercentilesBySize(CAmount result[NUM_GETBLOCKSTATS_PERCENTILES], std::vector<std::pair<CAmount, int64_t>>& scores, int64_t total_size);