diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/i2p.cpp | 4 | ||||
-rw-r--r-- | src/kernel/mempool_entry.h | 2 | ||||
-rw-r--r-- | src/kernel/mempool_persist.cpp | 18 | ||||
-rw-r--r-- | src/node/interfaces.cpp | 2 | ||||
-rw-r--r-- | src/rpc/mempool.cpp | 5 | ||||
-rw-r--r-- | src/txmempool.cpp | 12 | ||||
-rw-r--r-- | src/txmempool.h | 1 | ||||
-rw-r--r-- | src/validation.cpp | 4 |
8 files changed, 37 insertions, 11 deletions
diff --git a/src/i2p.cpp b/src/i2p.cpp index 685b43ba18..c891562d00 100644 --- a/src/i2p.cpp +++ b/src/i2p.cpp @@ -427,7 +427,7 @@ void Session::CreateIfNotCreatedAlready() const Reply& reply = SendRequestAndGetReply( *sock, strprintf("SESSION CREATE STYLE=STREAM ID=%s DESTINATION=TRANSIENT SIGNATURE_TYPE=7 " - "inbound.quantity=1 outbound.quantity=1", + "i2cp.leaseSetEncType=4,0 inbound.quantity=1 outbound.quantity=1", session_id)); m_private_key = DecodeI2PBase64(reply.Get("DESTINATION")); @@ -445,7 +445,7 @@ void Session::CreateIfNotCreatedAlready() SendRequestAndGetReply(*sock, strprintf("SESSION CREATE STYLE=STREAM ID=%s DESTINATION=%s " - "inbound.quantity=3 outbound.quantity=3", + "i2cp.leaseSetEncType=4,0 inbound.quantity=3 outbound.quantity=3", session_id, private_key_b64)); } diff --git a/src/kernel/mempool_entry.h b/src/kernel/mempool_entry.h index 1f175a5ccf..edd95e8d53 100644 --- a/src/kernel/mempool_entry.h +++ b/src/kernel/mempool_entry.h @@ -176,4 +176,6 @@ public: mutable Epoch::Marker m_epoch_marker; //!< epoch when last touched, useful for graph algorithms }; +using CTxMemPoolEntryRef = CTxMemPoolEntry::CTxMemPoolEntryRef; + #endif // BITCOIN_KERNEL_MEMPOOL_ENTRY_H diff --git a/src/kernel/mempool_persist.cpp b/src/kernel/mempool_persist.cpp index ff655c5ffa..f49cbe4439 100644 --- a/src/kernel/mempool_persist.cpp +++ b/src/kernel/mempool_persist.cpp @@ -60,10 +60,20 @@ bool LoadMempool(CTxMemPool& pool, const fs::path& load_path, Chainstate& active if (version != MEMPOOL_DUMP_VERSION) { return false; } - uint64_t num; - file >> num; - while (num) { - --num; + uint64_t total_txns_to_load; + file >> total_txns_to_load; + uint64_t txns_tried = 0; + LogPrintf("Loading %u mempool transactions from disk...\n", total_txns_to_load); + int next_tenth_to_report = 0; + while (txns_tried < total_txns_to_load) { + const int percentage_done(100.0 * txns_tried / total_txns_to_load); + if (next_tenth_to_report < percentage_done / 10) { + LogPrintf("Progress loading mempool transactions from disk: %d%% (tried %u, %u remaining)\n", + percentage_done, txns_tried, total_txns_to_load - txns_tried); + next_tenth_to_report = percentage_done / 10; + } + ++txns_tried; + CTransactionRef tx; int64_t nTime; int64_t nFeeDelta; diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp index f6dbe4f008..3930280797 100644 --- a/src/node/interfaces.cpp +++ b/src/node/interfaces.cpp @@ -806,7 +806,7 @@ public: { if (!m_node.mempool) return; LOCK2(::cs_main, m_node.mempool->cs); - for (const CTxMemPoolEntry& entry : m_node.mempool->mapTx) { + for (const CTxMemPoolEntry& entry : m_node.mempool->entryAll()) { notifications.transactionAddedToMempool(entry.GetSharedTx()); } } diff --git a/src/rpc/mempool.cpp b/src/rpc/mempool.cpp index 136969eb87..e113441993 100644 --- a/src/rpc/mempool.cpp +++ b/src/rpc/mempool.cpp @@ -344,14 +344,13 @@ UniValue MempoolToJSON(const CTxMemPool& pool, bool verbose, bool include_mempoo } LOCK(pool.cs); UniValue o(UniValue::VOBJ); - for (const CTxMemPoolEntry& e : pool.mapTx) { - const uint256& hash = e.GetTx().GetHash(); + for (const CTxMemPoolEntry& e : pool.entryAll()) { UniValue info(UniValue::VOBJ); entryToJSON(pool, info, e); // Mempool has unique entries so there is no advantage in using // UniValue::pushKV, which checks if the key already exists in O(N). // UniValue::pushKVEnd is used instead which currently is O(1). - o.pushKVEnd(hash.ToString(), info); + o.pushKVEnd(e.GetTx().GetHash().ToString(), info); } return o; } else { diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 461662ad93..8b744698ba 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -836,6 +836,18 @@ static TxMempoolInfo GetInfo(CTxMemPool::indexed_transaction_set::const_iterator return TxMempoolInfo{it->GetSharedTx(), it->GetTime(), it->GetFee(), it->GetTxSize(), it->GetModifiedFee() - it->GetFee()}; } +std::vector<CTxMemPoolEntryRef> CTxMemPool::entryAll() const +{ + AssertLockHeld(cs); + + std::vector<CTxMemPoolEntryRef> ret; + ret.reserve(mapTx.size()); + for (const auto& it : GetSortedDepthAndScore()) { + ret.emplace_back(*it); + } + return ret; +} + std::vector<TxMempoolInfo> CTxMemPool::infoAll() const { LOCK(cs); diff --git a/src/txmempool.h b/src/txmempool.h index cbeabb31fa..fd7006ab44 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -695,6 +695,7 @@ public: /** Returns info for a transaction if its entry_sequence < last_sequence */ TxMempoolInfo info_for_relay(const GenTxid& gtxid, uint64_t last_sequence) const; + std::vector<CTxMemPoolEntryRef> entryAll() const EXCLUSIVE_LOCKS_REQUIRED(cs); std::vector<TxMempoolInfo> infoAll() const; size_t DynamicMemoryUsage() const; diff --git a/src/validation.cpp b/src/validation.cpp index a6cab6b095..5d435fef8b 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -4850,7 +4850,9 @@ void ChainstateManager::CheckBlockIndex() // For testing, allow transaction counts to be completely unset. || (pindex->nChainTx == 0 && pindex->nTx == 0) // For testing, allow this nChainTx to be unset if previous is also unset. - || (pindex->nChainTx == 0 && prev_chain_tx == 0 && pindex->pprev)); + || (pindex->nChainTx == 0 && prev_chain_tx == 0 && pindex->pprev) + // Transaction counts prior to snapshot are unknown. + || pindex->IsAssumedValid()); if (pindexFirstAssumeValid == nullptr && pindex->nStatus & BLOCK_ASSUMED_VALID) pindexFirstAssumeValid = pindex; if (pindexFirstInvalid == nullptr && pindex->nStatus & BLOCK_FAILED_VALID) pindexFirstInvalid = pindex; |