Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 1,569 Lines • ▼ Show 20 Lines | static uint32_t GetBlockScriptFlags(const Config &config, | ||||
// alternative. We also start enforcing push only signatures and | // alternative. We also start enforcing push only signatures and | ||||
// clean stack. | // clean stack. | ||||
if (IsMagneticAnomalyEnabled(config, pChainTip)) { | if (IsMagneticAnomalyEnabled(config, pChainTip)) { | ||||
flags |= SCRIPT_ENABLE_CHECKDATASIG; | flags |= SCRIPT_ENABLE_CHECKDATASIG; | ||||
flags |= SCRIPT_VERIFY_SIGPUSHONLY; | flags |= SCRIPT_VERIFY_SIGPUSHONLY; | ||||
flags |= SCRIPT_VERIFY_CLEANSTACK; | flags |= SCRIPT_VERIFY_CLEANSTACK; | ||||
} | } | ||||
if (IsGreatWallEnabled(config, pChainTip)) { | |||||
flags |= SCRIPT_VERIFY_NULLDUMMY; | |||||
} | |||||
// We make sure this node will have replay protection during the next hard | // We make sure this node will have replay protection during the next hard | ||||
// fork. | // fork. | ||||
if (IsReplayProtectionEnabled(config, pChainTip)) { | if (IsReplayProtectionEnabled(config, pChainTip)) { | ||||
flags |= SCRIPT_ENABLE_REPLAY_PROTECTION; | flags |= SCRIPT_ENABLE_REPLAY_PROTECTION; | ||||
} | } | ||||
return flags; | return flags; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 325 Lines • ▼ Show 20 Lines | static bool ConnectBlock(const Config &config, const CBlock &block, | ||||
// If we just activated the replay protection with that block, it means | // If we just activated the replay protection with that block, it means | ||||
// transaction in the mempool are now invalid. As a result, we need to clear | // transaction in the mempool are now invalid. As a result, we need to clear | ||||
// the mempool. | // the mempool. | ||||
if (IsReplayProtectionEnabled(config, pindex) && | if (IsReplayProtectionEnabled(config, pindex) && | ||||
!IsReplayProtectionEnabled(config, pindex->pprev)) { | !IsReplayProtectionEnabled(config, pindex->pprev)) { | ||||
g_mempool.clear(); | g_mempool.clear(); | ||||
} | } | ||||
// If non-standard NULLDUMMY transactions were accepted before enforcement, | |||||
// then we risk having invalid tranasctions in the mempool. Clear it to be | |||||
// safe. | |||||
if (!fRequireStandard && (IsGreatWallEnabled(config, pindex)) && | |||||
!IsGreatWallEnabled(config, pindex->pprev)) { | |||||
g_mempool.clear(); | |||||
markblundeberg: @florian is working on on an improvement for this btw, that doesn't involve throwing away… | |||||
} | |||||
return true; | return true; | ||||
} | } | ||||
/** | /** | ||||
* Update the on-disk chain state. | * Update the on-disk chain state. | ||||
* The caches and indexes are flushed depending on the mode we're called with if | * The caches and indexes are flushed depending on the mode we're called with if | ||||
* they're too large, if it's been a while since the last write, or always and | * they're too large, if it's been a while since the last write, or always and | ||||
* in all cases if we're in prune mode and are deleting files. | * in all cases if we're in prune mode and are deleting files. | ||||
▲ Show 20 Lines • Show All 3,605 Lines • Show Last 20 Lines |
@florian is working on on an improvement for this btw, that doesn't involve throwing away everyone's transactions unnecessarily. -- all three activations (segwit recovery, nulldummy, schnorr) will benefit.