2 Comments
Aug 1Liked by Andrew Hong

The "Bitcoin Balances" query only checks WHERE i.spent_tx_id = o.tx_id to discard spent outputs.

Shouldn't it consider i.spent_tx_id = o.tx_id AND o.index = i.spent_output_number ?

The input could be spending another output from the same transaction!

Expand full comment
author

that's a great point! I've fixed it, thank you for catching my mistake.

Expand full comment