Skip to content
Permalink
Browse files

block_weight: fix python 2/3 compatibility

  • Loading branch information...
moneromooo-monero committed Mar 10, 2019
1 parent f2f725d commit 077c07d08b02f4b92b4e4041cecde72134a2d5b7
Showing with 8 additions and 6 deletions.
  1. +3 −2 tests/block_weight/block_weight.py
  2. +5 −4 tests/block_weight/compare.py
@@ -1,8 +1,9 @@
#!/usr/bin/python
#!/usr/bin/env python
# Simulate a maximal block attack on the Monero network
# 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)
@@ -1,13 +1,14 @@
#!/usr/bin/python
#!/usr/bin/env python

from __future__ import print_function
import sys
import subprocess

print 'running: ', sys.argv[1]
print('running: ', sys.argv[1])
S0 = subprocess.check_output(sys.argv[1], stderr=subprocess.STDOUT)
print 'running: ', sys.argv[2]
print('running: ', sys.argv[2])
S1 = subprocess.check_output(sys.argv[2], stderr=subprocess.STDOUT)
print 'comparing'
print('comparing')
if S0 != S1:
sys.exit(1)
sys.exit(0)

0 comments on commit 077c07d

Please sign in to comment.
You can’t perform that action at this time.