Skip to content

Commit 3b22072

Browse files
presstabFuzzbawls
authored andcommitted
Change spork key validity period. Minor spork code refactor.
1 parent caaedd9 commit 3b22072

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

src/chainparams.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ class CMainParams : public CChainParams
153153
nBlockEnforceInvalidUTXO = 902850; //Start enforcing the invalid UTXO's
154154
nInvalidAmountFiltered = 268200*COIN; //Amount of invalid coins filtered through exchanges, that should be considered valid
155155
nBlockZerocoinV2 = 99999999; //The block that zerocoin v2 becomes active
156-
nEnforceNewSporkKey = 1522454400; //!> Sporks signed after Saturday, March 31, 2018 12:00:00 AM GMT must use the new spork key
157-
nRejectOldSporkKey = 1523923200; //!> Fully reject old spork key after Tuesday, April 17, 2018 12:00:00 AM GMT
156+
nEnforceNewSporkKey = 1525158000; //!> Sporks signed after (GMT): Tuesday, May 1, 2018 7:00:00 AM GMT must use the new spork key
157+
nRejectOldSporkKey = 1527811200; //!> Fully reject old spork key after (GMT): Friday, June 1, 2018 12:00:00 AM
158158

159159
/**
160160
* Build the genesis block. Note that the output of the genesis coinbase cannot

src/spork.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -190,21 +190,18 @@ bool CSporkManager::CheckSignature(CSporkMessage& spork, bool fCheckSigner)
190190
CPubKey pubkeynew(ParseHex(Params().SporkKey()));
191191
std::string errorMessage = "";
192192

193-
if (fCheckSigner && !obfuScationSigner.VerifyMessage(pubkeynew, spork.vchSig,strMessage, errorMessage))
193+
bool fValidWithNewKey = obfuScationSigner.VerifyMessage(pubkeynew, spork.vchSig,strMessage, errorMessage);
194+
195+
if (fCheckSigner && !fValidWithNewKey)
194196
return false;
195197

196-
if (GetAdjustedTime() < Params().RejectOldSporkKey()) {
198+
// See if window is open that allows for old spork key to sign messages
199+
if (!fValidWithNewKey && GetAdjustedTime() < Params().RejectOldSporkKey()) {
197200
CPubKey pubkeyold(ParseHex(Params().SporkKeyOld()));
198-
if (obfuScationSigner.VerifyMessage(pubkeynew, spork.vchSig, strMessage, errorMessage) ||
199-
obfuScationSigner.VerifyMessage(pubkeyold, spork.vchSig, strMessage, errorMessage)) {
200-
return true;
201-
}
202-
}
203-
else if (obfuScationSigner.VerifyMessage(pubkeynew, spork.vchSig, strMessage, errorMessage)) {
204-
return true;
201+
return obfuScationSigner.VerifyMessage(pubkeyold, spork.vchSig, strMessage, errorMessage);
205202
}
206203

207-
return false;
204+
return fValidWithNewKey;
208205
}
209206

210207
bool CSporkManager::Sign(CSporkMessage& spork)

0 commit comments

Comments
 (0)