1
0
mirror of https://github.com/bigchaindb/bigchaindb.git synced 2024-06-28 08:37:45 +02:00

update comments

This commit is contained in:
Scott Sadler 2017-04-25 13:12:32 +02:00
parent 2200a7bda4
commit 01ba01083d
2 changed files with 15 additions and 11 deletions

View File

@ -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

View File

@ -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(