Merge pull request #5414

e9fac29a unit_tests/long_term_block_weight: some tweaks that seem to make more sense (stoffu)
467f4c7e tests/block_weight: use integer division when computing median (stoffu)
815d08dc tests/block_weight: remove unused MULTIPLIER_SMALL (stoffu)
661f1fb8 blockchain: remove unused calc of short_term_constraint (stoffu)
This commit is contained in:
Riccardo Spagni 2019-04-16 22:37:02 +02:00
commit 0d2aaac15b
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
3 changed files with 11 additions and 12 deletions

View file

@ -9,7 +9,6 @@ import math
MEDIAN_WINDOW_SMALL = 100 # number of recent blocks for median computation
MEDIAN_WINDOW_BIG = 5000
MULTIPLIER_SMALL = 1.4 # multipliers for determining weights
MULTIPLIER_BIG = 50.0
MEDIAN_THRESHOLD = 300*1000 # initial value for median (scaled kB -> B)
lcg_seed = 0
@ -24,9 +23,9 @@ def get_median(vec):
#temp = vec
temp = sorted(vec)
if len(temp) % 2 == 1:
return temp[len(temp)/2]
return temp[len(temp)//2]
else:
return int((temp[len(temp)/2]+temp[len(temp)/2-1])/2)
return int((temp[len(temp)//2]+temp[len(temp)//2-1])//2)
def LCG():
global lcg_seed