1
0
Fork 0
forked from lthn/blockchain

Merge pull request #6 from alfredmox/minor-fixes

Minor fixes
This commit is contained in:
cryptozoidberg 2019-02-09 19:52:30 +01:00 committed by GitHub
commit f4c789a0ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 5 deletions

View file

@ -420,7 +420,7 @@ namespace currency
total_blocks_parsing_time += block_parsing_time;
//to avoid concurrency in core between connections, suspend connections which delivered block later then first one
if(count = 2)
if(count == 2)
{
if(m_core.have_block(get_block_hash(b)))
{

View file

@ -35,9 +35,13 @@ int test_big_difficulties(const char* dataFile)
end = n - DIFFICULTY_LAG;
begin = end - DIFFICULTY_WINDOW;
}
auto stamps = vector<uint64_t>(timestamps.begin() + begin, timestamps.begin() + end);
auto cumulative_diffs = vector<currency::wide_difficulty_type>(cumulative_difficulties.begin() + begin, cumulative_difficulties.begin() + end);
currency::wide_difficulty_type res = currency::next_difficulty(
vector<uint64_t>(timestamps.begin() + begin, timestamps.begin() + end),
vector<currency::wide_difficulty_type>(cumulative_difficulties.begin() + begin, cumulative_difficulties.begin() + end), DEFAULT_TEST_DIFFICULTY_TARGET);
stamps,
cumulative_diffs,
DEFAULT_TEST_DIFFICULTY_TARGET
);
if (res != difficulty) {
cerr << "Wrong wide difficulty for block " << n << endl
<< "Expected: " << difficulty << endl
@ -90,9 +94,13 @@ int main(int argc, char *argv[]) {
<< "Found: " << res << endl;
return 1;
}
auto stamps = vector<uint64_t>(timestamps.begin() + begin, timestamps.begin() + end);
auto cumulative_diffs = vector<currency::wide_difficulty_type>(wide_cumulative_difficulties.begin() + begin, wide_cumulative_difficulties.begin() + end);
currency::wide_difficulty_type wide_res = currency::next_difficulty(
vector<uint64_t>(timestamps.begin() + begin, timestamps.begin() + end),
vector<currency::wide_difficulty_type>(wide_cumulative_difficulties.begin() + begin, wide_cumulative_difficulties.begin() + end), DEFAULT_TEST_DIFFICULTY_TARGET);
stamps,
cumulative_diffs,
DEFAULT_TEST_DIFFICULTY_TARGET
);
if (wide_res.convert_to<uint64_t>() != res) {
cerr << "Wrong wide difficulty for block " << n << endl
<< "Expected: " << res << endl
@ -110,3 +118,4 @@ int main(int argc, char *argv[]) {
return 0;
}