Fix wallet hard fork checks for sparse schedule
Some checks failed
ci/gh-actions/depends / Cross-Mac aarch64 (push) Failing after 8m18s
ci/gh-actions/depends / ARM v7 (push) Has been cancelled
ci/gh-actions/depends / i686 Linux (push) Has been cancelled
ci/gh-actions/depends / i686 Win (push) Has been cancelled
ci/gh-actions/depends / RISCV 64bit (push) Has been cancelled
ci/gh-actions/depends / Cross-Mac x86_64 (push) Has been cancelled
ci/gh-actions/depends / x86_64 Freebsd (push) Has been cancelled
ci/gh-actions/depends / ARM v8 (push) Has been cancelled
ci/gh-actions/depends / x86_64 Linux (push) Has been cancelled
ci/gh-actions/depends / Win64 (push) Has been cancelled
Some checks failed
ci/gh-actions/depends / Cross-Mac aarch64 (push) Failing after 8m18s
ci/gh-actions/depends / ARM v7 (push) Has been cancelled
ci/gh-actions/depends / i686 Linux (push) Has been cancelled
ci/gh-actions/depends / i686 Win (push) Has been cancelled
ci/gh-actions/depends / RISCV 64bit (push) Has been cancelled
ci/gh-actions/depends / Cross-Mac x86_64 (push) Has been cancelled
ci/gh-actions/depends / x86_64 Freebsd (push) Has been cancelled
ci/gh-actions/depends / ARM v8 (push) Has been cancelled
ci/gh-actions/depends / x86_64 Linux (push) Has been cancelled
ci/gh-actions/depends / Win64 (push) Has been cancelled
This commit is contained in:
@@ -3642,15 +3642,28 @@ void check_block_hard_fork_version(cryptonote::network_type nettype, uint8_t hf_
|
|||||||
const hardfork_t *wallet_hard_forks = nettype == TESTNET ? testnet_hard_forks
|
const hardfork_t *wallet_hard_forks = nettype == TESTNET ? testnet_hard_forks
|
||||||
: nettype == STAGENET ? stagenet_hard_forks : mainnet_hard_forks;
|
: nettype == STAGENET ? stagenet_hard_forks : mainnet_hard_forks;
|
||||||
|
|
||||||
wallet_is_outdated = static_cast<size_t>(hf_version) > wallet_num_hard_forks;
|
const hardfork_t *matched_hard_fork = nullptr;
|
||||||
|
const hardfork_t *next_hard_fork = nullptr;
|
||||||
|
for (size_t i = 0; i < wallet_num_hard_forks; ++i)
|
||||||
|
{
|
||||||
|
if (wallet_hard_forks[i].version == hf_version)
|
||||||
|
{
|
||||||
|
matched_hard_fork = &wallet_hard_forks[i];
|
||||||
|
if (i + 1 < wallet_num_hard_forks)
|
||||||
|
next_hard_fork = &wallet_hard_forks[i + 1];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wallet_is_outdated = matched_hard_fork == nullptr;
|
||||||
if (wallet_is_outdated)
|
if (wallet_is_outdated)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// check block's height falls within wallet's expected range for block's given version
|
// check block's height falls within wallet's expected range for block's given version
|
||||||
uint64_t start_height = hf_version == 1 ? 0 : wallet_hard_forks[hf_version - 1].height;
|
const uint64_t start_height = matched_hard_fork->height;
|
||||||
uint64_t end_height = static_cast<size_t>(hf_version) + 1 > wallet_num_hard_forks
|
const uint64_t end_height = next_hard_fork == nullptr
|
||||||
? std::numeric_limits<uint64_t>::max()
|
? std::numeric_limits<uint64_t>::max()
|
||||||
: wallet_hard_forks[hf_version].height;
|
: next_hard_fork->height;
|
||||||
|
|
||||||
daemon_is_outdated = height < start_height || height >= end_height;
|
daemon_is_outdated = height < start_height || height >= end_height;
|
||||||
}
|
}
|
||||||
@@ -12851,7 +12864,7 @@ uint8_t wallet2::estimate_current_hard_fork(const uint64_t height) const
|
|||||||
num_stagenet_hard_forks;
|
num_stagenet_hard_forks;
|
||||||
|
|
||||||
// Iterate over the hard fork table, to see what the current fork is for the guessed height
|
// Iterate over the hard fork table, to see what the current fork is for the guessed height
|
||||||
for (size_t i = hfs_count-1; i>=0; --i) {
|
for (size_t i = hfs_count; i-- > 0; ) {
|
||||||
if (hfs[i].height <= guessed_height)
|
if (hfs[i].height <= guessed_height)
|
||||||
return hfs[i].version;
|
return hfs[i].version;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user