diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-01-14 22:41:14 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-01-14 22:41:14 +0000 |
commit | feb499aaae496361f0b96a76ab614dca5258a5c1 (patch) | |
tree | 0325227a5d79bfb8ca1d498af491a8e064ecd681 /src/cryptonote_core/hardfork.cpp | |
parent | Merge pull request #1566 (diff) | |
download | monero-feb499aaae496361f0b96a76ab614dca5258a5c1.tar.xz |
core: check block version for alt chains too
This is incompatible with block version voting
Diffstat (limited to 'src/cryptonote_core/hardfork.cpp')
-rw-r--r-- | src/cryptonote_core/hardfork.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/cryptonote_core/hardfork.cpp b/src/cryptonote_core/hardfork.cpp index c63ca36ef..8f9ff97d3 100644 --- a/src/cryptonote_core/hardfork.cpp +++ b/src/cryptonote_core/hardfork.cpp @@ -114,6 +114,19 @@ bool HardFork::check(const cryptonote::block &block) const return do_check(::get_block_version(block), ::get_block_vote(block)); } +bool HardFork::do_check_for_height(uint8_t block_version, uint8_t voting_version, uint64_t height) const +{ + int fork_index = get_voted_fork_index(height); + return block_version == heights[fork_index].version + && voting_version >= heights[fork_index].version; +} + +bool HardFork::check_for_height(const cryptonote::block &block, uint64_t height) const +{ + CRITICAL_REGION_LOCAL(lock); + return do_check_for_height(::get_block_version(block), ::get_block_vote(block), height); +} + bool HardFork::add(uint8_t block_version, uint8_t voting_version, uint64_t height) { CRITICAL_REGION_LOCAL(lock); |