Blockstream / Blockstream/esplora
`GET /tx/:txid/outspend/:vout` returns 200 status for transactions which do not exist
- Dominant language
- JavaScript
- Stars
- 1.3k
- Forks
- 514
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 16
Description
### Problem
The response of `GET /tx/:txid/outspend/:vout` for a txid which does not exist is 200 with a payload
```json
{
"spent": false
}
```
which is identical to valid utxos which have not been spent.
for example:
```
https://blockstream.info/api/tx/b779bc24f17f0cea8dc556d4d1301642986517bfbbc631eab8a6454fca1202bb/outspend/0
```
returns 200 with the payload above but the transaction `b779bc24f17f0cea8dc556d4d1301642986517bfbbc631eab8a6454fca1202bb` does not exist.
That contradicts with the `GET /tx/:txid` endpoint which returns a 404 for non existent txids. Following the example above `https://blockstream.info/api/tx/b779bc24f17f0cea8dc556d4d1301642986517bfbbc631eab8a6454fca1202bb` returns 404:
```json
Transaction not found
```
The response of `GET /tx/:txid/outspend/:vout` is non consistent when querying inexsistent utxos.
### Expected behavior
I would expect `GET /tx/:txid/outspend/:vout` to return a 404 for utxos which do not exist or have been dropped.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing the GET /tx/:txid/outspend/:vout endpoint and compare its handling with GET /tx/:txid for a nonexistent transaction. Verify the behavior for nonexistent transactions and valid unspent outputs; done means nonexistent or dropped UTXOs return 404 while valid unspent UTXOs retain their distinct response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100