Update ice age

This commit is contained in:
Vitalik Buterin 2017-05-30 08:35:21 -04:00
parent ac89506000
commit 43ebb25299
2 changed files with 18 additions and 12 deletions

View File

@ -1,12 +1,12 @@
import random
import datetime
diffs = [343.14 * 10**12]
hashpower = diffs[0] / 15
times = [1493974999]
diffs = [453.71 * 10**12]
hashpower = diffs[0] / 15.73
times = [1495425834]
for i in range(3653829, 6010000):
for i in range(3746966, 6010000):
blocktime = random.expovariate(hashpower / diffs[-1])
adjfac = max(1 - int(blocktime / 10), -99) / 2048.
newdiff = diffs[-1] * (1 + adjfac)
@ -15,6 +15,6 @@ for i in range(3653829, 6010000):
diffs.append(newdiff)
times.append(times[-1] + blocktime)
if i % 10000 == 0:
print 'Block %d, approx ETH supply %d, time %r blocktime %.2f' % \
(i, 60102216 * 1.199 + 5.3 * i, datetime.datetime.utcfromtimestamp(times[-1]).isoformat().replace('T',' '), diffs[-1] / hashpower)
print('Block %d, approx ETH supply %d, time %r blocktime %.2f' % \
(i, 60102216 * 1.199 + 5.3 * i, datetime.datetime.utcfromtimestamp(times[-1]).isoformat().replace('T',' '), diffs[-1] / hashpower))
# print int(adjfac * 2048)

View File

@ -41,9 +41,11 @@ def test_strat(strat, hashpower, gamma, reward, fees, uncle_rewards=1, uncle_coe
if me_blocks >= len(strat) or them_blocks >= len(strat[me_blocks]) or strat[me_blocks][them_blocks] == 1:
# Override
if me_blocks > them_blocks or (me_blocks == them_blocks and random.random() < gamma):
me_reward += me_blocks * reward - (reward if me_blocks and them_blocks else 0)
# me_reward += me_blocks * reward - (reward if me_blocks and them_blocks else 0)
me_reward += me_blocks * reward
me_fees += time_elapsed * fees
divisor += me_blocks - (1 if me_blocks and them_blocks else 0)
# divisor += me_blocks - (1 if me_blocks and them_blocks else 0)
divisor += me_blocks
me_totblocks += me_blocks
# Add uncles
while me_blocks < 7 and them_blocks > 0:
@ -55,9 +57,11 @@ def test_strat(strat, hashpower, gamma, reward, fees, uncle_rewards=1, uncle_coe
me_blocks += 1
# Adopt
else:
them_reward += them_blocks * reward - (reward if me_blocks and them_blocks else 0)
# them_reward += them_blocks * reward - (reward if me_blocks and them_blocks else 0)
them_reward += them_blocks * reward
them_fees += time_elapsed * fees
divisor += them_blocks - (1 if me_blocks and them_blocks else 0)
# divisor += them_blocks - (1 if me_blocks and them_blocks else 0)
divisor += them_blocks
them_totblocks += them_blocks
# Add uncles
while them_blocks < 7 and me_blocks > 0:
@ -73,9 +77,11 @@ def test_strat(strat, hashpower, gamma, reward, fees, uncle_rewards=1, uncle_coe
# Match
elif strat[me_blocks][them_blocks] == 2 and not last_is_me:
if random.random() < gamma:
me_reward += me_blocks * reward + time_elapsed * fees - (reward if me_blocks and them_blocks else 0)
# me_reward += me_blocks * reward + time_elapsed * fees - (reward if me_blocks and them_blocks else 0)
me_reward += me_blocks * reward
me_totblocks += me_blocks
divisor += me_blocks - (1 if me_blocks and them_blocks else 0)
# divisor += me_blocks - (1 if me_blocks and them_blocks else 0)
divisor += me_blocks
time_elapsed = 0
# Add uncles
while me_blocks < 7 and them_blocks > 0: