main: spentindex for the mempool
This commit is contained in:
10
src/main.cpp
10
src/main.cpp
@@ -1415,10 +1415,17 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState &state, const C
|
||||
|
||||
// Store transaction in memory
|
||||
pool.addUnchecked(hash, entry, setAncestors, !IsInitialBlockDownload());
|
||||
|
||||
// Add memory address index
|
||||
if (fAddressIndex) {
|
||||
pool.addAddressIndex(entry, view);
|
||||
}
|
||||
|
||||
// Add memory spent index
|
||||
if (fSpentIndex) {
|
||||
pool.addSpentIndex(entry, view);
|
||||
}
|
||||
|
||||
// trim mempool and check if tx was trimmed
|
||||
if (!fOverrideMempoolLimit) {
|
||||
LimitMempoolSize(pool, GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000, GetArg("-mempoolexpiry", DEFAULT_MEMPOOL_EXPIRY) * 60 * 60);
|
||||
@@ -1460,6 +1467,9 @@ bool GetSpentIndex(CSpentIndexKey &key, CSpentIndexValue &value)
|
||||
if (!fSpentIndex)
|
||||
return false;
|
||||
|
||||
if (mempool.getSpentIndex(key, value))
|
||||
return true;
|
||||
|
||||
if (!pblocktree->ReadSpentIndex(key, value))
|
||||
return error("unable to get spent info");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user