@@ -186,8 +186,11 @@ enum FlushStateMode {
186
186
};
187
187
188
188
// See definition for documentation
189
- bool static FlushStateToDisk (CValidationState &state, FlushStateMode mode, int nManualPruneHeight=0 );
190
- void FindFilesToPruneManual (std::set<int >& setFilesToPrune, int nManualPruneHeight);
189
+ static bool FlushStateToDisk (const CChainParams& chainParams, CValidationState &state, FlushStateMode mode, int nManualPruneHeight=0 );
190
+ static void FindFilesToPruneManual (std::set<int >& setFilesToPrune, int nManualPruneHeight);
191
+ static void FindFilesToPrune (std::set<int >& setFilesToPrune, uint64_t nPruneAfterHeight);
192
+ static bool CheckInputs (const CTransaction& tx, CValidationState &state, const CCoinsViewCache &inputs, bool fScriptChecks , unsigned int flags, bool cacheStore, PrecomputedTransactionData& txdata, std::vector<CScriptCheck> *pvChecks = NULL );
193
+ static FILE* OpenUndoFile (const CDiskBlockPos &pos, bool fReadOnly = false );
191
194
192
195
bool CheckFinalTx (const CTransaction &tx, int flags)
193
196
{
@@ -309,7 +312,7 @@ bool CheckSequenceLocks(const CTransaction &tx, int flags, LockPoints* lp, bool
309
312
return EvaluateSequenceLocks (index, lockPair);
310
313
}
311
314
312
- void LimitMempoolSize (CTxMemPool& pool, size_t limit, unsigned long age) {
315
+ static void LimitMempoolSize (CTxMemPool& pool, size_t limit, unsigned long age) {
313
316
int expired = pool.Expire (GetTime () - age);
314
317
if (expired != 0 ) {
315
318
LogPrint (BCLog::MEMPOOL, " Expired %i transactions from the memory pool\n " , expired);
@@ -392,7 +395,7 @@ void UpdateMempoolForReorg(DisconnectedBlockTransactions &disconnectpool, bool f
392
395
LimitMempoolSize (mempool, GetArg (" -maxmempool" , DEFAULT_MAX_MEMPOOL_SIZE) * 1000000 , GetArg (" -mempoolexpiry" , DEFAULT_MEMPOOL_EXPIRY) * 60 * 60 );
393
396
}
394
397
395
- bool AcceptToMemoryPoolWorker (CTxMemPool& pool, CValidationState& state, const CTransactionRef& ptx, bool fLimitFree ,
398
+ static bool AcceptToMemoryPoolWorker (const CChainParams& chainparams, CTxMemPool& pool, CValidationState& state, const CTransactionRef& ptx, bool fLimitFree ,
396
399
bool * pfMissingInputs, int64_t nAcceptTime, std::list<CTransactionRef>* plTxnReplaced,
397
400
bool fOverrideMempoolLimit , const CAmount& nAbsurdFee, std::vector<COutPoint>& coins_to_uncache)
398
401
{
@@ -410,7 +413,7 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
410
413
return state.DoS (100 , false , REJECT_INVALID, " coinbase" );
411
414
412
415
// Reject transactions with witness before segregated witness activates (override with -prematurewitness)
413
- bool witnessEnabled = IsWitnessEnabled (chainActive.Tip (), Params () .GetConsensus ());
416
+ bool witnessEnabled = IsWitnessEnabled (chainActive.Tip (), chainparams .GetConsensus ());
414
417
if (!GetBoolArg (" -prematurewitness" ,false ) && tx.HasWitness () && !witnessEnabled) {
415
418
return state.DoS (0 , false , REJECT_NONSTANDARD, " no-witness-yet" , true );
416
419
}
@@ -739,7 +742,7 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
739
742
}
740
743
741
744
unsigned int scriptVerifyFlags = STANDARD_SCRIPT_VERIFY_FLAGS;
742
- if (!Params () .RequireStandard ()) {
745
+ if (!chainparams .RequireStandard ()) {
743
746
scriptVerifyFlags = GetArg (" -promiscuousmempoolflags" , scriptVerifyFlags);
744
747
}
745
748
@@ -809,27 +812,29 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
809
812
return true ;
810
813
}
811
814
812
- bool AcceptToMemoryPoolWithTime (CTxMemPool& pool, CValidationState &state, const CTransactionRef &tx, bool fLimitFree ,
815
+ /* * (try to) add transaction to memory pool with a specified acceptance time **/
816
+ static bool AcceptToMemoryPoolWithTime (const CChainParams& chainparams, CTxMemPool& pool, CValidationState &state, const CTransactionRef &tx, bool fLimitFree ,
813
817
bool * pfMissingInputs, int64_t nAcceptTime, std::list<CTransactionRef>* plTxnReplaced,
814
818
bool fOverrideMempoolLimit , const CAmount nAbsurdFee)
815
819
{
816
820
std::vector<COutPoint> coins_to_uncache;
817
- bool res = AcceptToMemoryPoolWorker (pool, state, tx, fLimitFree , pfMissingInputs, nAcceptTime, plTxnReplaced, fOverrideMempoolLimit , nAbsurdFee, coins_to_uncache);
821
+ bool res = AcceptToMemoryPoolWorker (chainparams, pool, state, tx, fLimitFree , pfMissingInputs, nAcceptTime, plTxnReplaced, fOverrideMempoolLimit , nAbsurdFee, coins_to_uncache);
818
822
if (!res) {
819
823
BOOST_FOREACH (const COutPoint& hashTx, coins_to_uncache)
820
824
pcoinsTip->Uncache (hashTx);
821
825
}
822
826
// After we've (potentially) uncached entries, ensure our coins cache is still within its size limits
823
827
CValidationState stateDummy;
824
- FlushStateToDisk (stateDummy, FLUSH_STATE_PERIODIC);
828
+ FlushStateToDisk (chainparams, stateDummy, FLUSH_STATE_PERIODIC);
825
829
return res;
826
830
}
827
831
828
832
bool AcceptToMemoryPool (CTxMemPool& pool, CValidationState &state, const CTransactionRef &tx, bool fLimitFree ,
829
833
bool * pfMissingInputs, std::list<CTransactionRef>* plTxnReplaced,
830
834
bool fOverrideMempoolLimit , const CAmount nAbsurdFee)
831
835
{
832
- return AcceptToMemoryPoolWithTime (pool, state, tx, fLimitFree , pfMissingInputs, GetTime (), plTxnReplaced, fOverrideMempoolLimit , nAbsurdFee);
836
+ const CChainParams& chainparams = Params ();
837
+ return AcceptToMemoryPoolWithTime (chainparams, pool, state, tx, fLimitFree , pfMissingInputs, GetTime (), plTxnReplaced, fOverrideMempoolLimit , nAbsurdFee);
833
838
}
834
839
835
840
/* * Return transaction in txOut, and if it was found inside a block, its hash is placed in hashBlock */
@@ -898,7 +903,7 @@ bool GetTransaction(const uint256 &hash, CTransactionRef &txOut, const Consensus
898
903
// CBlock and CBlockIndex
899
904
//
900
905
901
- bool WriteBlockToDisk (const CBlock& block, CDiskBlockPos& pos, const CMessageHeader::MessageStartChars& messageStart)
906
+ static bool WriteBlockToDisk (const CBlock& block, CDiskBlockPos& pos, const CMessageHeader::MessageStartChars& messageStart)
902
907
{
903
908
// Open history file to append
904
909
CAutoFile fileout (OpenBlockFile (pos), SER_DISK, CLIENT_VERSION);
@@ -1011,7 +1016,7 @@ static void AlertNotify(const std::string& strMessage)
1011
1016
boost::thread t (runCommand, strCmd); // thread runs free
1012
1017
}
1013
1018
1014
- void CheckForkWarningConditions ()
1019
+ static void CheckForkWarningConditions ()
1015
1020
{
1016
1021
AssertLockHeld (cs_main);
1017
1022
// Before we get past initial download, we cannot reliably alert about forks
@@ -1052,7 +1057,7 @@ void CheckForkWarningConditions()
1052
1057
}
1053
1058
}
1054
1059
1055
- void CheckForkWarningConditionsOnNewFork (CBlockIndex* pindexNewForkTip)
1060
+ static void CheckForkWarningConditionsOnNewFork (CBlockIndex* pindexNewForkTip)
1056
1061
{
1057
1062
AssertLockHeld (cs_main);
1058
1063
// If we are on a fork that is sufficiently large, set a warning flag
@@ -1144,7 +1149,12 @@ int GetSpendHeight(const CCoinsViewCache& inputs)
1144
1149
return pindexPrev->nHeight + 1 ;
1145
1150
}
1146
1151
1147
- bool CheckInputs (const CTransaction& tx, CValidationState &state, const CCoinsViewCache &inputs, bool fScriptChecks , unsigned int flags, bool cacheStore, PrecomputedTransactionData& txdata, std::vector<CScriptCheck> *pvChecks)
1152
+ /* *
1153
+ * Check whether all inputs of this transaction are valid (no double spends, scripts & sigs, amounts)
1154
+ * This does not modify the UTXO set. If pvChecks is not NULL, script checks are pushed onto it
1155
+ * instead of being performed inline.
1156
+ */
1157
+ static bool CheckInputs (const CTransaction& tx, CValidationState &state, const CCoinsViewCache &inputs, bool fScriptChecks , unsigned int flags, bool cacheStore, PrecomputedTransactionData& txdata, std::vector<CScriptCheck> *pvChecks)
1148
1158
{
1149
1159
if (!tx.IsCoinBase ())
1150
1160
{
@@ -1411,7 +1421,7 @@ void static FlushBlockFile(bool fFinalize = false)
1411
1421
}
1412
1422
}
1413
1423
1414
- bool FindUndoPos (CValidationState &state, int nFile, CDiskBlockPos &pos, unsigned int nAddSize);
1424
+ static bool FindUndoPos (CValidationState &state, int nFile, CDiskBlockPos &pos, unsigned int nAddSize);
1415
1425
1416
1426
static CCheckQueue<CScriptCheck> scriptcheckqueue (128 );
1417
1427
@@ -1730,9 +1740,8 @@ static bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockInd
1730
1740
* if they're too large, if it's been a while since the last write,
1731
1741
* or always and in all cases if we're in prune mode and are deleting files.
1732
1742
*/
1733
- bool static FlushStateToDisk (CValidationState &state, FlushStateMode mode, int nManualPruneHeight) {
1743
+ bool static FlushStateToDisk (const CChainParams& chainparams, CValidationState &state, FlushStateMode mode, int nManualPruneHeight) {
1734
1744
int64_t nMempoolUsage = mempool.DynamicMemoryUsage ();
1735
- const CChainParams& chainparams = Params ();
1736
1745
LOCK2 (cs_main, cs_LastBlockFile);
1737
1746
static int64_t nLastWrite = 0 ;
1738
1747
static int64_t nLastFlush = 0 ;
@@ -1836,13 +1845,15 @@ bool static FlushStateToDisk(CValidationState &state, FlushStateMode mode, int n
1836
1845
1837
1846
void FlushStateToDisk () {
1838
1847
CValidationState state;
1839
- FlushStateToDisk (state, FLUSH_STATE_ALWAYS);
1848
+ const CChainParams& chainparams = Params ();
1849
+ FlushStateToDisk (chainparams, state, FLUSH_STATE_ALWAYS);
1840
1850
}
1841
1851
1842
1852
void PruneAndFlush () {
1843
1853
CValidationState state;
1844
1854
fCheckForPruning = true ;
1845
- FlushStateToDisk (state, FLUSH_STATE_NONE);
1855
+ const CChainParams& chainparams = Params ();
1856
+ FlushStateToDisk (chainparams, state, FLUSH_STATE_NONE);
1846
1857
}
1847
1858
1848
1859
static void DoWarning (const std::string& strWarning)
@@ -1939,7 +1950,7 @@ bool static DisconnectTip(CValidationState& state, const CChainParams& chainpara
1939
1950
}
1940
1951
LogPrint (BCLog::BENCH, " - Disconnect block: %.2fms\n " , (GetTimeMicros () - nStart) * 0.001 );
1941
1952
// Write the chain state to disk, if necessary.
1942
- if (!FlushStateToDisk (state, FLUSH_STATE_IF_NEEDED))
1953
+ if (!FlushStateToDisk (chainparams, state, FLUSH_STATE_IF_NEEDED))
1943
1954
return false ;
1944
1955
1945
1956
if (disconnectpool) {
@@ -2076,7 +2087,7 @@ bool static ConnectTip(CValidationState& state, const CChainParams& chainparams,
2076
2087
int64_t nTime4 = GetTimeMicros (); nTimeFlush += nTime4 - nTime3;
2077
2088
LogPrint (BCLog::BENCH, " - Flush: %.2fms [%.2fs]\n " , (nTime4 - nTime3) * 0.001 , nTimeFlush * 0.000001 );
2078
2089
// Write the chain state to disk, if necessary.
2079
- if (!FlushStateToDisk (state, FLUSH_STATE_IF_NEEDED))
2090
+ if (!FlushStateToDisk (chainparams, state, FLUSH_STATE_IF_NEEDED))
2080
2091
return false ;
2081
2092
int64_t nTime5 = GetTimeMicros (); nTimeChainState += nTime5 - nTime4;
2082
2093
LogPrint (BCLog::BENCH, " - Writing chainstate: %.2fms [%.2fs]\n " , (nTime5 - nTime4) * 0.001 , nTimeChainState * 0.000001 );
@@ -2336,7 +2347,7 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
2336
2347
CheckBlockIndex (chainparams.GetConsensus ());
2337
2348
2338
2349
// Write changes periodically to disk, after relay.
2339
- if (!FlushStateToDisk (state, FLUSH_STATE_PERIODIC)) {
2350
+ if (!FlushStateToDisk (chainparams, state, FLUSH_STATE_PERIODIC)) {
2340
2351
return false ;
2341
2352
}
2342
2353
@@ -2453,7 +2464,7 @@ bool ResetBlockFailureFlags(CBlockIndex *pindex) {
2453
2464
return true ;
2454
2465
}
2455
2466
2456
- CBlockIndex* AddToBlockIndex (const CBlockHeader& block)
2467
+ static CBlockIndex* AddToBlockIndex (const CBlockHeader& block)
2457
2468
{
2458
2469
// Check for duplicate
2459
2470
uint256 hash = block.GetHash ();
@@ -2537,7 +2548,7 @@ static bool ReceivedBlockTransactions(const CBlock &block, CValidationState& sta
2537
2548
return true ;
2538
2549
}
2539
2550
2540
- bool FindBlockPos (CValidationState &state, CDiskBlockPos &pos, unsigned int nAddSize, unsigned int nHeight, uint64_t nTime, bool fKnown = false )
2551
+ static bool FindBlockPos (CValidationState &state, CDiskBlockPos &pos, unsigned int nAddSize, unsigned int nHeight, uint64_t nTime, bool fKnown = false )
2541
2552
{
2542
2553
LOCK (cs_LastBlockFile);
2543
2554
@@ -2594,7 +2605,7 @@ bool FindBlockPos(CValidationState &state, CDiskBlockPos &pos, unsigned int nAdd
2594
2605
return true ;
2595
2606
}
2596
2607
2597
- bool FindUndoPos (CValidationState &state, int nFile, CDiskBlockPos &pos, unsigned int nAddSize)
2608
+ static bool FindUndoPos (CValidationState &state, int nFile, CDiskBlockPos &pos, unsigned int nAddSize)
2598
2609
{
2599
2610
pos.nFile = nFile;
2600
2611
@@ -2625,7 +2636,7 @@ bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, unsigne
2625
2636
return true ;
2626
2637
}
2627
2638
2628
- bool CheckBlockHeader (const CBlockHeader& block, CValidationState& state, const Consensus::Params& consensusParams, bool fCheckPOW )
2639
+ static bool CheckBlockHeader (const CBlockHeader& block, CValidationState& state, const Consensus::Params& consensusParams, bool fCheckPOW = true )
2629
2640
{
2630
2641
// Check proof of work matches claimed amount
2631
2642
if (fCheckPOW && !CheckProofOfWork (block.GetHash (), block.nBits , consensusParams))
@@ -2775,7 +2786,10 @@ std::vector<unsigned char> GenerateCoinbaseCommitment(CBlock& block, const CBloc
2775
2786
return commitment;
2776
2787
}
2777
2788
2778
- bool ContextualCheckBlockHeader (const CBlockHeader& block, CValidationState& state, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev, int64_t nAdjustedTime)
2789
+ /* * Context-dependent validity checks.
2790
+ * By "context", we mean only the previous block headers, but not the UTXO
2791
+ * set; UTXO-related validity checks are done in ConnectBlock(). */
2792
+ static bool ContextualCheckBlockHeader (const CBlockHeader& block, CValidationState& state, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev, int64_t nAdjustedTime)
2779
2793
{
2780
2794
assert (pindexPrev != NULL );
2781
2795
const int nHeight = pindexPrev->nHeight + 1 ;
@@ -2802,7 +2816,7 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
2802
2816
return true ;
2803
2817
}
2804
2818
2805
- bool ContextualCheckBlock (const CBlock& block, CValidationState& state, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev)
2819
+ static bool ContextualCheckBlock (const CBlock& block, CValidationState& state, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev)
2806
2820
{
2807
2821
const int nHeight = pindexPrev == NULL ? 0 : pindexPrev->nHeight + 1 ;
2808
2822
@@ -3026,7 +3040,7 @@ static bool AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CValidation
3026
3040
}
3027
3041
3028
3042
if (fCheckForPruning )
3029
- FlushStateToDisk (state, FLUSH_STATE_NONE); // we just allocated more disk space for block files
3043
+ FlushStateToDisk (chainparams, state, FLUSH_STATE_NONE); // we just allocated more disk space for block files
3030
3044
3031
3045
return true ;
3032
3046
}
@@ -3094,7 +3108,7 @@ bool TestBlockValidity(CValidationState& state, const CChainParams& chainparams,
3094
3108
*/
3095
3109
3096
3110
/* Calculate the amount of disk space the block & undo files currently use */
3097
- uint64_t CalculateCurrentUsage ()
3111
+ static uint64_t CalculateCurrentUsage ()
3098
3112
{
3099
3113
uint64_t retval = 0 ;
3100
3114
BOOST_FOREACH (const CBlockFileInfo &file, vinfoBlockFile) {
@@ -3147,7 +3161,7 @@ void UnlinkPrunedFiles(const std::set<int>& setFilesToPrune)
3147
3161
}
3148
3162
3149
3163
/* Calculate the block/rev files to delete based on height specified by user with RPC command pruneblockchain */
3150
- void FindFilesToPruneManual (std::set<int >& setFilesToPrune, int nManualPruneHeight)
3164
+ static void FindFilesToPruneManual (std::set<int >& setFilesToPrune, int nManualPruneHeight)
3151
3165
{
3152
3166
assert (fPruneMode && nManualPruneHeight > 0 );
3153
3167
@@ -3172,11 +3186,26 @@ void FindFilesToPruneManual(std::set<int>& setFilesToPrune, int nManualPruneHeig
3172
3186
void PruneBlockFilesManual (int nManualPruneHeight)
3173
3187
{
3174
3188
CValidationState state;
3175
- FlushStateToDisk (state, FLUSH_STATE_NONE, nManualPruneHeight);
3189
+ const CChainParams& chainparams = Params ();
3190
+ FlushStateToDisk (chainparams, state, FLUSH_STATE_NONE, nManualPruneHeight);
3176
3191
}
3177
3192
3178
- /* Calculate the block/rev files that should be deleted to remain under target*/
3179
- void FindFilesToPrune (std::set<int >& setFilesToPrune, uint64_t nPruneAfterHeight)
3193
+ /* *
3194
+ * Prune block and undo files (blk???.dat and undo???.dat) so that the disk space used is less than a user-defined target.
3195
+ * The user sets the target (in MB) on the command line or in config file. This will be run on startup and whenever new
3196
+ * space is allocated in a block or undo file, staying below the target. Changing back to unpruned requires a reindex
3197
+ * (which in this case means the blockchain must be re-downloaded.)
3198
+ *
3199
+ * Pruning functions are called from FlushStateToDisk when the global fCheckForPruning flag has been set.
3200
+ * Block and undo files are deleted in lock-step (when blk00003.dat is deleted, so is rev00003.dat.)
3201
+ * Pruning cannot take place until the longest chain is at least a certain length (100000 on mainnet, 1000 on testnet, 1000 on regtest).
3202
+ * Pruning will never delete a block within a defined distance (currently 288) from the active chain's tip.
3203
+ * The block index is updated by unsetting HAVE_DATA and HAVE_UNDO for any blocks that were stored in the deleted files.
3204
+ * A db flag records the fact that at least some block files have been pruned.
3205
+ *
3206
+ * @param[out] setFilesToPrune The set of file indices that can be unlinked will be returned
3207
+ */
3208
+ static void FindFilesToPrune (std::set<int >& setFilesToPrune, uint64_t nPruneAfterHeight)
3180
3209
{
3181
3210
LOCK2 (cs_main, cs_LastBlockFile);
3182
3211
if (chainActive.Tip () == NULL || nPruneTarget == 0 ) {
@@ -3234,7 +3263,7 @@ bool CheckDiskSpace(uint64_t nAdditionalBytes)
3234
3263
return true ;
3235
3264
}
3236
3265
3237
- FILE* OpenDiskFile (const CDiskBlockPos &pos, const char *prefix, bool fReadOnly )
3266
+ static FILE* OpenDiskFile (const CDiskBlockPos &pos, const char *prefix, bool fReadOnly )
3238
3267
{
3239
3268
if (pos.IsNull ())
3240
3269
return NULL ;
@@ -3261,7 +3290,8 @@ FILE* OpenBlockFile(const CDiskBlockPos &pos, bool fReadOnly) {
3261
3290
return OpenDiskFile (pos, " blk" , fReadOnly );
3262
3291
}
3263
3292
3264
- FILE* OpenUndoFile (const CDiskBlockPos &pos, bool fReadOnly ) {
3293
+ /* * Open an undo file (rev?????.dat) */
3294
+ static FILE* OpenUndoFile (const CDiskBlockPos &pos, bool fReadOnly ) {
3265
3295
return OpenDiskFile (pos, " rev" , fReadOnly );
3266
3296
}
3267
3297
@@ -3533,7 +3563,7 @@ bool RewindBlockIndex(const CChainParams& params)
3533
3563
return error (" RewindBlockIndex: unable to disconnect block at height %i" , pindex->nHeight );
3534
3564
}
3535
3565
// Occasionally flush state to disk.
3536
- if (!FlushStateToDisk (state, FLUSH_STATE_PERIODIC))
3566
+ if (!FlushStateToDisk (params, state, FLUSH_STATE_PERIODIC))
3537
3567
return false ;
3538
3568
}
3539
3569
@@ -3582,7 +3612,7 @@ bool RewindBlockIndex(const CChainParams& params)
3582
3612
3583
3613
CheckBlockIndex (params.GetConsensus ());
3584
3614
3585
- if (!FlushStateToDisk (state, FLUSH_STATE_ALWAYS)) {
3615
+ if (!FlushStateToDisk (params, state, FLUSH_STATE_ALWAYS)) {
3586
3616
return false ;
3587
3617
}
3588
3618
@@ -3655,7 +3685,7 @@ bool InitBlockIndex(const CChainParams& chainparams)
3655
3685
if (!ReceivedBlockTransactions (block, state, pindex, blockPos, chainparams.GetConsensus ()))
3656
3686
return error (" LoadBlockIndex(): genesis block not accepted" );
3657
3687
// Force a chainstate write so that when we VerifyDB in a moment, it doesn't check stale data
3658
- return FlushStateToDisk (state, FLUSH_STATE_ALWAYS);
3688
+ return FlushStateToDisk (chainparams, state, FLUSH_STATE_ALWAYS);
3659
3689
} catch (const std::runtime_error& e) {
3660
3690
return error (" LoadBlockIndex(): failed to initialize block database: %s" , e.what ());
3661
3691
}
@@ -3997,6 +4027,7 @@ static const uint64_t MEMPOOL_DUMP_VERSION = 1;
3997
4027
3998
4028
bool LoadMempool (void )
3999
4029
{
4030
+ const CChainParams& chainparams = Params ();
4000
4031
int64_t nExpiryTimeout = GetArg (" -mempoolexpiry" , DEFAULT_MEMPOOL_EXPIRY) * 60 * 60 ;
4001
4032
FILE* filestr = fsbridge::fopen (GetDataDir () / " mempool.dat" , " rb" );
4002
4033
CAutoFile file (filestr, SER_DISK, CLIENT_VERSION);
@@ -4033,7 +4064,7 @@ bool LoadMempool(void)
4033
4064
CValidationState state;
4034
4065
if (nTime + nExpiryTimeout > nNow) {
4035
4066
LOCK (cs_main);
4036
- AcceptToMemoryPoolWithTime (mempool, state, tx, true , NULL , nTime);
4067
+ AcceptToMemoryPoolWithTime (chainparams, mempool, state, tx, true , NULL , nTime, NULL , false , 0 );
4037
4068
if (state.IsValid ()) {
4038
4069
++count;
4039
4070
} else {
0 commit comments