From 5124b8978ba63151900b3e8835734ddc7e1e5c7b Mon Sep 17 00:00:00 2001 From: random-zebra Date: Tue, 10 Sep 2019 16:31:15 +0200 Subject: [PATCH] [Spork] Do not accept sporks signed too far into the future --- src/spork.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/spork.cpp b/src/spork.cpp index e9628fcf11aac..3d997f8a9acdd 100644 --- a/src/spork.cpp +++ b/src/spork.cpp @@ -66,6 +66,14 @@ void CSporkManager::ProcessSpork(CNode* pfrom, std::string& strCommand, CDataStr std::string strSpork = sporkManager.GetSporkNameByID(spork.nSporkID); if (strSpork == "Unknown") return; + // Do not accept sporks signed way too far into the future + if (spork.nTimeSigned > GetAdjustedTime() + 2 * 60 * 60) { + LOCK(cs_main); + LogPrintf("%s -- ERROR: too far into the future\n", __func__); + Misbehaving(pfrom->GetId(), 100); + return; + } + uint256 hash = spork.GetHash(); { LOCK(cs);