citp/BlockSci

question about the fluent interface

yya518 opened this issue · 1 comments

System Information (if applicable)

BlockSci version: 0.6
Blockchain: Bitcoin

I would love to use the fluent interface for fast selection and filtering of blockchain data. However, the following code which selects outputs that is spent after certain height returns error.

height = 400000
chain[:height].outputs.where(lambda o: o.spending_tx.block_height > height )

AttributeError: 'blocksci.proxy.OptionalTxProxy' object has no attribute 'block_height'

I read from the document that the most attributes support comparison operations, so am wondering how to access object properties from the proxy? Thank you.

i guess it can be solved by a map function.

chain[:height].outputs.where(lambda o: o.spending_tx.map(lambda x: x.block.height).or_value(999999) > height)