block_weight: fix python 2/3 compatibility

This commit is contained in:
moneromooo-monero 2019-03-10 14:35:44 +00:00
parent 55d7eb06a8
commit 1a91385eaf
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
2 changed files with 7 additions and 5 deletions

View file

@ -3,6 +3,7 @@
# This uses the scheme proposed by ArticMine # This uses the scheme proposed by ArticMine
# Written by Sarang Nother # Written by Sarang Nother
# Copyright (c) 2019 The Monero Project # Copyright (c) 2019 The Monero Project
from __future__ import print_function
import sys import sys
import math import math
@ -67,7 +68,7 @@ def run(t, blocks):
lt_weights.append(min(max_weight,int(ltembw + int(ltembw * 2 / 5)))) 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, 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(0, 2 * MEDIAN_WINDOW_BIG)
run(1, 9 * MEDIAN_WINDOW_BIG) run(1, 9 * MEDIAN_WINDOW_BIG)

View file

@ -1,5 +1,6 @@
#!/usr/bin/python #!/usr/bin/env python
from __future__ import print_function
import sys import sys
import subprocess import subprocess
@ -10,11 +11,11 @@ else:
first = [sys.argv[1]] first = [sys.argv[1]]
second = [sys.argv[2]] second = [sys.argv[2]]
print 'running: ', first print('running: ', first)
S0 = subprocess.check_output(first, stderr=subprocess.STDOUT) S0 = subprocess.check_output(first, stderr=subprocess.STDOUT)
print 'running: ', second print('running: ', second)
S1 = subprocess.check_output(second, stderr=subprocess.STDOUT) S1 = subprocess.check_output(second, stderr=subprocess.STDOUT)
print 'comparing' print('comparing')
if S0 != S1: if S0 != S1:
sys.exit(1) sys.exit(1)
sys.exit(0) sys.exit(0)