election logging

This commit is contained in:
ryan 2016-08-03 17:38:40 +02:00
parent eb10ffcba0
commit 877fc15456

View File

@ -4,6 +4,8 @@ Specifically, what happens when a block becomes invalid. The logic is
encapsulated in the ``Election`` class, while the sequence of actions
is specified in ``create_pipeline``.
"""
import logging
import rethinkdb as r
from multipipes import Pipeline, Node
@ -11,6 +13,9 @@ from bigchaindb.pipelines.utils import ChangeFeed
from bigchaindb import Bigchain
logger = logging.getLogger(__name__)
class Election:
def __init__(self):
@ -30,6 +35,9 @@ class Election:
"""
Liquidates transactions from invalid blocks so they can be processed again
"""
logger.info('Rewriting %s transactions from invalid block %s',
len(invalid_block['block']['transactions']),
invalid_block['id'])
for tx in invalid_block['block']['transactions']:
self.bigchain.write_transaction(tx)
return invalid_block