diff --git a/bigchaindb/backend/query.py b/bigchaindb/backend/query.py index 0f746132..6f76249b 100644 --- a/bigchaindb/backend/query.py +++ b/bigchaindb/backend/query.py @@ -148,7 +148,8 @@ def get_spending_transactions(connection, inputs): inputs (list): list of {txid, output} Returns: - List of transactions that spend given inputs + Iterator of (block_ids, transaction) for transactions that + spend given inputs. """ raise NotImplementedError @@ -161,9 +162,9 @@ def get_owned_ids(connection, owner): owner (str): base58 encoded public key. Returns: - A cursor for the matching transactions. + Iterator of (block_id, transaction) for transactions + that list given owner in conditions. """ - raise NotImplementedError @@ -205,7 +206,7 @@ def get_votes_for_blocks_by_voter(connection, block_ids, pubkey): pubkey (str): public key of voting node Returns: - A cursor of votes matching given votes. + A cursor of votes matching given block_ids and public key """ raise NotImplementedError diff --git a/bigchaindb/fastquery.py b/bigchaindb/fastquery.py index a7147722..deffabe1 100644 --- a/bigchaindb/fastquery.py +++ b/bigchaindb/fastquery.py @@ -4,24 +4,27 @@ from bigchaindb.common.transaction import TransactionLink class FastQuery: - """ Database queries that join on block results from a single node. - * Votes are not validated for security (security is replication concern) - * Votes come from only one node, and as such, fault tolerance is reduced + * Votes are not validated for security (security is a replication concern) + * Votes come from only one node, and as such, non-byzantine fault tolerance + is reduced. - In return, these queries offer good performance, as it is not neccesary to validate - each result separately. + Previously, to consider the status of a block, all votes for that block + were retrieved and the election results were counted. This meant that a + faulty node may still have been able to obtain a correct election result. + However, from the point of view of a client, it is still neccesary to + query multiple nodes to insure against getting an incorrect response from + a byzantine node. """ - def __init__(self, connection, me): self.connection = connection self.me = me def filter_block_ids(self, block_ids, include_undecided=True): """ - Given block ids, filter the invalid blocks + Given block ids, filter the invalid blocks. """ block_ids = list(set(block_ids)) votes = query.get_votes_for_blocks_by_voter(