mirror of
https://github.com/monero-project/monero.git
synced 2025-05-02 13:56:06 -04:00
core: move hardforks into its own lib
So it can be used by others without encumbrance
This commit is contained in:
parent
2c171a9b02
commit
d0663837d2
10 changed files with 220 additions and 144 deletions
|
@ -87,7 +87,7 @@ bool HardFork::add_fork(uint8_t version, uint64_t height, uint8_t threshold, tim
|
|||
}
|
||||
if (threshold > 100)
|
||||
return false;
|
||||
heights.push_back(Params(version, height, threshold, time));
|
||||
heights.push_back(hardfork_t(version, height, threshold, time));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ void HardFork::init()
|
|||
|
||||
// add a placeholder for the default version, to avoid special cases
|
||||
if (heights.empty())
|
||||
heights.push_back(Params(original_version, 0, 0, 0));
|
||||
heights.push_back(hardfork_t(original_version, 0, 0, 0));
|
||||
|
||||
versions.clear();
|
||||
for (size_t n = 0; n < 256; ++n)
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "syncobj.h"
|
||||
#include "hardforks/hardforks.h"
|
||||
#include "cryptonote_basic/cryptonote_basic.h"
|
||||
|
||||
namespace cryptonote
|
||||
|
@ -230,14 +231,6 @@ namespace cryptonote
|
|||
*/
|
||||
uint64_t get_window_size() const { return window_size; }
|
||||
|
||||
struct Params {
|
||||
uint8_t version;
|
||||
uint8_t threshold;
|
||||
uint64_t height;
|
||||
time_t time;
|
||||
Params(uint8_t version, uint64_t height, uint8_t threshold, time_t time): version(version), threshold(threshold), height(height), time(time) {}
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
uint8_t get_block_version(uint64_t height) const;
|
||||
|
@ -262,7 +255,7 @@ namespace cryptonote
|
|||
uint8_t original_version;
|
||||
uint64_t original_version_till_height;
|
||||
|
||||
std::vector<Params> heights;
|
||||
std::vector<hardfork_t> heights;
|
||||
|
||||
std::deque<uint8_t> versions; /* rolling window of the last N blocks' versions */
|
||||
unsigned int last_versions[256]; /* count of the block versions in the last N blocks */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue