mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Merge pull request #1470 from bigchaindb/fix/outputs-public-keys-validate
check output conditions with single statement (#1450 unrevert)
This commit is contained in:
commit
e89623c836
@ -1,4 +1,4 @@
|
|||||||
from bigchaindb.utils import output_has_owner
|
from bigchaindb.utils import condition_details_has_owner
|
||||||
from bigchaindb.backend import query
|
from bigchaindb.backend import query
|
||||||
from bigchaindb.common.transaction import TransactionLink
|
from bigchaindb.common.transaction import TransactionLink
|
||||||
|
|
||||||
@ -52,7 +52,8 @@ class FastQuery:
|
|||||||
return [TransactionLink(tx['id'], index)
|
return [TransactionLink(tx['id'], index)
|
||||||
for tx in txs
|
for tx in txs
|
||||||
for index, output in enumerate(tx['outputs'])
|
for index, output in enumerate(tx['outputs'])
|
||||||
if output_has_owner(output, public_key)]
|
if condition_details_has_owner(output['condition']['details'],
|
||||||
|
public_key)]
|
||||||
|
|
||||||
def filter_spent_outputs(self, outputs):
|
def filter_spent_outputs(self, outputs):
|
||||||
"""
|
"""
|
||||||
|
@ -113,19 +113,6 @@ def condition_details_has_owner(condition_details, owner):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def output_has_owner(output, owner):
|
|
||||||
# TODO
|
|
||||||
# Check whether it is really necessary to treat the single key case
|
|
||||||
# differently from the multiple keys case, and why not just use the same
|
|
||||||
# function for both cases.
|
|
||||||
if len(output['public_keys']) > 1:
|
|
||||||
return condition_details_has_owner(
|
|
||||||
output['condition']['details'], owner)
|
|
||||||
elif len(output['public_keys']) == 1:
|
|
||||||
return output['condition']['details']['public_key'] == owner
|
|
||||||
# TODO raise proper exception, e.g. invalid tx payload?
|
|
||||||
|
|
||||||
|
|
||||||
def is_genesis_block(block):
|
def is_genesis_block(block):
|
||||||
"""Check if the block is the genesis block.
|
"""Check if the block is the genesis block.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user