Implement automatic shutdown of deprecated Zcash versions

Closes #2274.
This commit is contained in:
Jack Grigg
2017-04-25 18:06:29 +12:00
parent 20d61ac0ea
commit 5b3bc9716e
10 changed files with 203 additions and 2 deletions

23
src/deprecation.h Normal file
View File

@@ -0,0 +1,23 @@
// Copyright (c) 2017 The Zcash developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef ZCASH_DEPRECATION_H
#define ZCASH_DEPRECATION_H
// Deprecation policy is 4th third-Tuesday after a release
static const int APPROX_RELEASE_HEIGHT = 115000;
static const int WEEKS_UNTIL_DEPRECATION = 18;
static const int DEPRECATION_HEIGHT = APPROX_RELEASE_HEIGHT + (WEEKS_UNTIL_DEPRECATION * 7 * 24 * 24);
// Number of blocks before deprecation to warn users
static const int DEPRECATION_WARN_LIMIT = 14 * 24 * 24; // 2 weeks
/**
* Checks whether the node is deprecated based on the current block height, and
* shuts down the node with an error if so (and deprecation is not disabled for
* the current client version).
*/
void EnforceNodeDeprecation(int nHeight, bool forceLogging=false);
#endif // ZCASH_DEPRECATION_H