fix mongodb write_block without thouching mongodb code

This commit is contained in:
Rodolphe Marques 2016-12-20 18:04:38 +01:00
parent 1d7a8e3369
commit 71bb63376f
2 changed files with 2 additions and 2 deletions

View File

@ -134,7 +134,7 @@ def get_votes_by_block_id_and_voter(connection, block_id, node_pubkey):
def write_block(connection, block):
return connection.run(
r.table('bigchain')
.insert(r.json(block), durability=WRITE_DURABILITY))
.insert(r.json(block.to_str()), durability=WRITE_DURABILITY))
@register_query(RethinkDBConnection)

View File

@ -516,7 +516,7 @@ class Bigchain(object):
block (Block): block to write to bigchain.
"""
return backend.query.write_block(self.connection, block.to_str())
return backend.query.write_block(self.connection, block)
def transaction_exists(self, transaction_id):
return backend.query.has_transaction(self.connection, transaction_id)