Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit d24c4f2

Browse files
committed
fixed tests
1 parent c61d2da commit d24c4f2

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

ethereum/chain.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ def _update_head(self, block):
158158
uncles.discard(self.get(u))
159159
if blk.has_parent():
160160
blk = blk.get_parent()
161-
# TODO: make this work
162-
uncles = list(uncles)[:0]
161+
162+
uncles = list(uncles)
163163
ts = max(int(time.time()), block.timestamp + 1)
164164
self.head_candidate = blocks.Block.init_from_parent(block, coinbase=self._coinbase,
165165
timestamp=ts, uncles=uncles)

ethereum/tests/test_blocks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ def run_block_test(params):
6666
raise Exception("state root mismatch")
6767
if b.hash != utils.scanners['bin'](gbh["hash"]):
6868
raise Exception("header hash mismatch")
69-
assert b.header.check_pow(e)
69+
assert b.header.check_pow()
7070
for blk in params["blocks"]:
7171
if 'blockHeader' not in blk:
7272
try:
7373
rlpdata = decode_hex(blk["rlp"][2:])
7474
b2 = rlp.decode(rlpdata, blocks.Block, parent=b, db=e)
7575
success = True
76-
except (ValueError, TypeError, VerificationFailed,
76+
except (ValueError, TypeError, AttributeError, VerificationFailed,
7777
DecodingError, DeserializationError, InvalidTransaction):
7878
success = False
7979
assert not success

ethereum/tests/test_chain.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,12 +505,14 @@ def test_reward_uncles(db):
505505
blk1 = mine_on_chain(chain, blk0, coinbase=local_coinbase)
506506
assert blk1.hash in chain
507507
assert uncle.hash in chain
508+
assert uncle.hash != blk1.hash
508509
assert chain.head == blk1
509510
assert chain.head.get_balance(local_coinbase) == 1 * blocks.BLOCK_REWARD
510511
assert chain.head.get_balance(uncle_coinbase) == 0
511512
# next block should reward uncles
512513
blk2 = mine_on_chain(chain, coinbase=local_coinbase)
513514
assert blk2.get_parent().prevhash == uncle.prevhash
515+
assert len(blk2.uncles) == 1
514516
assert blk2 == chain.head
515517
assert chain.head.get_balance(local_coinbase) == \
516518
2 * blocks.BLOCK_REWARD + blocks.NEPHEW_REWARD

0 commit comments

Comments
 (0)