diff options
Diffstat (limited to 'tests/block_weight')
-rw-r--r-- | tests/block_weight/block_weight.cpp | 5 | ||||
-rwxr-xr-x | tests/block_weight/block_weight.py | 3 | ||||
-rwxr-xr-x | tests/block_weight/compare.py | 9 |
3 files changed, 12 insertions, 5 deletions
diff --git a/tests/block_weight/block_weight.cpp b/tests/block_weight/block_weight.cpp index 1e8974b78..7b3fdfe57 100644 --- a/tests/block_weight/block_weight.cpp +++ b/tests/block_weight/block_weight.cpp @@ -84,6 +84,11 @@ public: while (count-- && start_height < blocks.size()) ret.push_back(blocks[start_height++].long_term_weight); return ret; } + virtual crypto::hash get_block_hash_from_height(const uint64_t &height) const override { + crypto::hash hash = crypto::null_hash; + *(uint64_t*)&hash = height; + return hash; + } virtual crypto::hash top_block_hash(uint64_t *block_height = NULL) const override { uint64_t h = height(); crypto::hash top = crypto::null_hash; diff --git a/tests/block_weight/block_weight.py b/tests/block_weight/block_weight.py index d6fd494e3..ba533c53c 100755 --- a/tests/block_weight/block_weight.py +++ b/tests/block_weight/block_weight.py @@ -3,6 +3,7 @@ # This uses the scheme proposed by ArticMine # Written by Sarang Nother # Copyright (c) 2019 The Monero Project +from __future__ import print_function import sys import math @@ -67,7 +68,7 @@ def run(t, blocks): lt_weights.append(min(max_weight,int(ltembw + int(ltembw * 2 / 5)))) #print "H %u, r %u, BW %u, EMBW %u, LTBW %u, LTEMBW %u, ltmedian %u" % (block, r, max_weight, embw, lt_weights[-1], ltembw, ltmedian) - print "H %u, BW %u, EMBW %u, LTBW %u" % (block, max_weight, embw, lt_weights[-1]) + print("H %u, BW %u, EMBW %u, LTBW %u" % (block, max_weight, embw, lt_weights[-1])) run(0, 2 * MEDIAN_WINDOW_BIG) run(1, 9 * MEDIAN_WINDOW_BIG) diff --git a/tests/block_weight/compare.py b/tests/block_weight/compare.py index e058a7079..e046e1640 100755 --- a/tests/block_weight/compare.py +++ b/tests/block_weight/compare.py @@ -1,5 +1,6 @@ -#!/usr/bin/python +#!/usr/bin/env python +from __future__ import print_function import sys import subprocess @@ -10,11 +11,11 @@ else: first = [sys.argv[1]] second = [sys.argv[2]] -print 'running: ', first +print('running: ', first) S0 = subprocess.check_output(first, stderr=subprocess.STDOUT) -print 'running: ', second +print('running: ', second) S1 = subprocess.check_output(second, stderr=subprocess.STDOUT) -print 'comparing' +print('comparing') if S0 != S1: sys.exit(1) sys.exit(0) |