-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
When adding a block and the HF changes the tx-pool is re-validated:
monero/src/cryptonote_core/blockchain.cpp
Lines 4356 to 4368 in 8d6aff9
const uint8_t new_hf_version = get_current_hard_fork_version(); | |
if (new_hf_version != hf_version) | |
{ | |
// the genesis block is added before everything's setup, and the txpool is empty | |
// when we start from scratch, so we skip this | |
const bool is_genesis_block = new_height == 1; | |
if (!is_genesis_block) | |
{ | |
MGINFO("Validating txpool for v" << (unsigned)new_hf_version); | |
m_tx_pool.validate(new_hf_version); | |
} | |
} |
Which would freeze up the node for a while with a big tx-pool. Cuprate caches when a tx was validated with the tx in the pool: https://github.com/Cuprate/cuprate/blob/065054996d4db3e86a02205ed01aa6a6286003a6/types/types/src/transaction_verification_data.rs#L35 so we don't need to do tx-pool re-validation at start up/when a HF changes, we only re-validate a single tx if the current blockchain state requires it compared to the cached verification.
monerod could probably do something similar, just caching the HF each tx was validated at and doing ver_non_input_consensus
added in #9135 if the HF has changed when adding the tx to the blockchain, skipping the need for re-validation of the whole txpool at the same time.
Originally posted by @Boog900 in #9404 (comment)