treat genesis block as valid (#433)

This commit is contained in:
Ryan Henderson
2016-07-14 10:31:10 +02:00
committed by GitHub
parent fe136bea9c
commit 47e1b3cf4e
2 changed files with 4 additions and 2 deletions

View File

@@ -129,7 +129,7 @@ class BaseConsensusRules(AbstractConsensusRules):
# If the operation is CREATE the transaction should have no inputs and
# should be signed by a federation node
if transaction['transaction']['operation'] == 'CREATE':
if transaction['transaction']['operation'] in ('CREATE', 'GENESIS'):
# TODO: for now lets assume a CREATE transaction only has one fulfillment
if transaction['transaction']['fulfillments'][0]['input']:
raise ValueError('A CREATE operation has no inputs')

View File

@@ -259,7 +259,9 @@ class TestBigchainApi(object):
genesis = list(r.table('bigchain')
.filter(r.row['block_number'] == 0)
.run(b.conn))[0]
assert b.get_last_voted_block() == genesis
gb = b.get_last_voted_block()
assert gb == genesis
assert b.validate_block(gb) == gb
def test_get_last_voted_block_returns_the_correct_block(self, b):
genesis = b.create_genesis_block()