mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
parent
c5bad99f4e
commit
b94a9ec7e9
@ -153,14 +153,22 @@ def get_spent(conn, transaction_id, output):
|
||||
cursor = conn.run(
|
||||
conn.collection('bigchain').aggregate([
|
||||
{'$match': {
|
||||
'block.transactions.inputs.fulfills.txid': transaction_id,
|
||||
'block.transactions.inputs.fulfills.output': output
|
||||
'block.transactions.inputs': {
|
||||
'$elemMatch': {
|
||||
'fulfills.txid': transaction_id,
|
||||
'fulfills.output': output,
|
||||
},
|
||||
},
|
||||
}},
|
||||
{'$unwind': '$block.transactions'},
|
||||
{'$match': {
|
||||
'block.transactions.inputs.fulfills.txid': transaction_id,
|
||||
'block.transactions.inputs.fulfills.output': output
|
||||
}}
|
||||
'block.transactions.inputs': {
|
||||
'$elemMatch': {
|
||||
'fulfills.txid': transaction_id,
|
||||
'fulfills.output': output,
|
||||
},
|
||||
},
|
||||
}},
|
||||
]))
|
||||
# we need to access some nested fields before returning so lets use a
|
||||
# generator to avoid having to read all records on the cursor at this point
|
||||
|
Loading…
x
Reference in New Issue
Block a user