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

Commit 6363e13

Browse files
committed
make_head_candidate() now returns both the block and state
Also fixes mk_genesis_data() to use the correct key names. Closes #726
1 parent 492ce21 commit 6363e13

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

ethereum/genesis_helpers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def mk_genesis_data(env, **kwargs):
6767

6868
allowed_args = set([
6969
'start_alloc',
70-
'prevhash',
70+
'parent_hash',
7171
'coinbase',
7272
'difficulty',
7373
'gas_limit',
@@ -79,12 +79,12 @@ def mk_genesis_data(env, **kwargs):
7979
assert set(kwargs.keys()).issubset(allowed_args)
8080

8181
genesis_data = {
82-
"prevhash": kwargs.get('prevhash', encode_hex(env.config['GENESIS_PREVHASH'])),
82+
"parentHash": kwargs.get('parent_hash', encode_hex(env.config['GENESIS_PREVHASH'])),
8383
"coinbase": kwargs.get('coinbase', encode_hex(env.config['GENESIS_COINBASE'])),
8484
"difficulty": kwargs.get('difficulty', env.config['GENESIS_DIFFICULTY']),
85-
"gas_limit": kwargs.get('gas_limit', env.config['GENESIS_GAS_LIMIT']),
85+
"gasLimit": kwargs.get('gas_limit', env.config['GENESIS_GAS_LIMIT']),
8686
"timestamp": kwargs.get('timestamp', 0),
87-
"extra_data": kwargs.get('extra_data', encode_hex(env.config['GENESIS_EXTRA_DATA'])),
87+
"extraData": kwargs.get('extra_data', encode_hex(env.config['GENESIS_EXTRA_DATA'])),
8888
"mixhash": kwargs.get('mixhash', encode_hex(env.config['GENESIS_MIXHASH'])),
8989
"nonce": kwargs.get('nonce', encode_hex(env.config['GENESIS_NONCE'])),
9090
"alloc": kwargs.get('start_alloc', env.config['GENESIS_INITIAL_ALLOC'])

ethereum/meta.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,4 @@ def make_head_candidate(chain, txqueue=None,
6666
# Set state root, receipt root, etc
6767
set_execution_results(temp_state, blk)
6868
log.info('Created head candidate successfully')
69-
return blk
69+
return blk, temp_state

ethereum/tests/test_chain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def mine_on_chain(chain, parent=None, transactions=[], coinbase=None, timestamp=
5454
for t in transactions:
5555
txqueue.add_transaction(t)
5656
parent_timestamp = parent.timestamp if parent else chain.state.timestamp
57-
hc = meta.make_head_candidate(chain, txqueue, parent,
57+
hc, _ = meta.make_head_candidate(chain, txqueue, parent,
5858
timestamp or parent_timestamp + 1, coinbase or '\x00'*20)
5959
assert hc.difficulty == 1
6060
m = ethpow.Miner(hc)

ethereum/tests/todo/test_pos.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
# Create and sign a block
5656
def make_block(chain, key, randao, vchash, skips):
57-
h = make_head_candidate(chain, TransactionQueue(), timestamp=get_timestamp(chain, skips))
57+
h, _ = make_head_candidate(chain, TransactionQueue(), timestamp=get_timestamp(chain, skips))
5858
return sign_block(h, key, randao.get_parent(call_casper(chain.state, 'getRandao', [vchash])), vchash, skips)
5959

6060
next_validator = call_casper(s, 'getValidator', [0])

0 commit comments

Comments
 (0)