Page MenuHomePhabricator

D478.id.diff
No OneTemporary

D478.id.diff

diff --git a/src/net_processing.cpp b/src/net_processing.cpp
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -1682,6 +1682,12 @@
}
else if (strCommand == NetMsgType::ADDR) {
+ // We don't want addr from non-Cash peers if we're on the Cash chain
+ // already.
+ if (!(pfrom->nServices & NODE_BITCOIN_CASH) && fActiveChainTipIsUAHF) {
+ return true;
+ }
+
std::vector<CAddress> vAddr;
vRecv >> vAddr;
diff --git a/src/validation.h b/src/validation.h
--- a/src/validation.h
+++ b/src/validation.h
@@ -190,6 +190,9 @@
extern bool fCheckBlockIndex;
extern bool fCheckpointsEnabled;
extern size_t nCoinCacheUsage;
+/** True if and only if chainActive.Tip()'s medianTimePast >= UAHFStartTime.
+ * Updated in validation.cpp :: UpdateTip() */
+extern std::atomic_bool fActiveChainTipIsUAHF;
/** A fee rate smaller than this is considered zero fee (for relaying, mining
* and transaction creation) */
diff --git a/src/validation.cpp b/src/validation.cpp
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -74,6 +74,8 @@
bool fRequireStandard = true;
bool fCheckBlockIndex = false;
bool fCheckpointsEnabled = DEFAULT_CHECKPOINTS_ENABLED;
+std::atomic_bool fActiveChainTipIsUAHF(false);
+
size_t nCoinCacheUsage = 5000 * 300;
uint64_t nPruneTarget = 0;
int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE;
@@ -2236,6 +2238,10 @@
chainActive.SetTip(pindexNew);
+ // other code that cares about being conditional on UAHF
+ // might need this flag
+ fActiveChainTipIsUAHF = IsUAHFenabledForCurrentBlock(config);
+
// New best block
mempool.AddTransactionsUpdated(1);

File Metadata

Mime Type
text/plain
Expires
Mon, May 12, 01:40 (3 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5776795
Default Alt Text
D478.id.diff (1 KB)

Event Timeline