Blockchair / Blockchair.Support

Public repository for issues and feature requests. Submit your favorite bug!
444 stars 321 forks source link

Is this a bug? is_spent(false) actually includes spent transactions... and no way to filter them out... #188

Open AustEcon opened 5 years ago

AustEcon commented 5 years ago

These transactions here: https://blockchair.com/bitcoin-sv/outputs?q=spending_transaction_id(282743134)&s=spending_index(asc)#

Are incorrectly being included in the response from: https://api.blockchair.com/bitcoin-sv/outputs?q=recipient(qzf8wn3lfw8ne4tru9l49z6h3zqnq5gj3qdc887fcj),is_spent(false),block_id(0..)&limit=100&offset=0 --> see context.total_rows = 415 instead when it should be 202 (my correct number of utxos)

please advise. I have spent most of the day trying to link up to your api and this is really causing me trouble... it looks like your response is just giving a "None" value for things like spending_transaction_id(282743134) so there's no way I can even hack around it by making my own filters. There's no way to filter out the true utxos from the 415 that I get back...

AustEcon commented 5 years ago

But then when I apply the same filter to this transaction it recognises them as being spent and filters them all away (I'm pretty sure this is a bug or database syncing issue): https://blockchair.com/bitcoin-sv/outputs?q=spending_transaction_id(282743134),is_spent(false)&s=spending_index(asc)#

So basically - as a workaround - I will have to extract a list of txids from the first is_spent(false) query and then filter all of those txids to get the ones that really are utxos.

Please advise

AustEcon commented 5 years ago

Additionally - when I try to do a workaround solution of:' https://api.blockchair.com/bitcoin-sv/outputs?q=recipient(qzf8wn3lfw8ne4tru9l49z6h3zqnq5gj3qdc887fcj)&limit=100 and then just page through all of the rows (1550 rows total in context.total_rows)... and extract all unique txids... there are only 61 not 64 as there should be so you have data missing?

I don't understand why this is all happening??? Thanks

Edit: Okay but this is handly: https://api.blockchair.com/bitcoin-sv/dashboards/address/qzf8wn3lfw8ne4tru9l49z6h3zqnq5gj3qdc887fcj (gives 64 total txids...). I can work with that.

Har01d commented 5 years ago

Since v.2.0.26 the recommended way to query the UTXO set of an address is via the api.blockchair.com/{:chain}/dashboards/address/{:address}?limit={:tx_limit},{:utxo_limit} call.

Filters in the api.blockchair.com/{:chain}/outputs endpoint can show some ghost rows for recently spent outputs (this is the only table which may contain ghost rows). As of now, we delete remained duplicates once in 24 hours, we’ll see if we can make that run more frequently.

But if what you’re requiring is just the UTXO set — please use the new recommended way and you’ll be all good — it filters out duplicates automatically.