mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
Merge bitcoin/bitcoin#27460: rpc: Add importmempool RPC
fa776e61cdAdd importmempool RPC (MarcoFalke)fa20d734a2refactor: Add and use kernel::ImportMempoolOptions (MarcoFalke)fa8866990ddoc: Clarify the getmempoolinfo.loaded RPC field documentation (MarcoFalke)6888886cecRemove Chainstate::LoadMempool (MarcoFalke) Pull request description: Currently it is possible to import a mempool by placing it in the datadir and starting the node. However this has many issues: * Users aren't expected to fiddle with the datadir, possibly corrupting it * An existing mempool file in the datadir may be overwritten * The node needs to be restarted * Importing an untrusted file this way is dangerous, because it can corrupt the mempool Fix all issues by adding a new RPC. ACKs for top commit: ajtowns: utACKfa776e61cdachow101: ACKfa776e61cdglozow: reACKfa776e61cdTree-SHA512: fcb1a92d6460839283c546c47a2d930c363ac1013c4c50dc5215ddf9fe5e51921d23fe0abfae0a5a7631983cfc7e2fff3788b70f95937d0a989a203be4d67546
This commit is contained in:
@@ -116,6 +116,7 @@
|
||||
#endif
|
||||
|
||||
using kernel::DumpMempool;
|
||||
using kernel::LoadMempool;
|
||||
using kernel::ValidationCacheSizes;
|
||||
|
||||
using node::ApplyArgsManOptions;
|
||||
@@ -1676,7 +1677,10 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||
return;
|
||||
}
|
||||
// Load mempool from disk
|
||||
chainman.ActiveChainstate().LoadMempool(ShouldPersistMempool(args) ? MempoolPath(args) : fs::path{});
|
||||
if (auto* pool{chainman.ActiveChainstate().GetMempool()}) {
|
||||
LoadMempool(*pool, ShouldPersistMempool(args) ? MempoolPath(args) : fs::path{}, chainman.ActiveChainstate(), {});
|
||||
pool->SetLoadTried(!chainman.m_interrupt);
|
||||
}
|
||||
});
|
||||
|
||||
// Wait for genesis block to be processed
|
||||
|
||||
Reference in New Issue
Block a user