fix(api): allow parsing empty TXIDs #115
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In some cases,
mempool/electrsreturns an empty string for TXIDs in the input list when querying for address transactions.TXID:
c138e61852baf252d81056f6a779d84d65efc830c202215d7b904d5b1e546039Address:
tb1qp5dt5a96udwds8kmjz0vd2yy0q3ltn6cx56dy7Observe that the response from
curl https://mempool.drivechain.live/api/address/tb1qp5dt5a96udwds8kmjz0vd2yy0q3ltn6cx56dy7/txs(including the relevant part below) includes an input withtxidset to the empty string. I'm not sure what precisely causes this. However, it strikes me as OK in being a bit more lenient with what we accept as input without crashing and burning.{ "txid": "c138e61852baf252d81056f6a779d84d65efc830c202215d7b904d5b1e546039", "version": 2, "locktime": 0, "size": 300, "weight": 1092, "fee": 0, "vin": [ { "is_coinbase": true, "prevout": null, "scriptsig": "02f11900", "scriptsig_asm": "", "sequence": 4294967295, "txid": "", "vout": 0, "witness": [ "0000000000000000000000000000000000000000000000000000000000000000" ], "inner_redeemscript_asm": "", "inner_witnessscript_asm": "" } ], "vout": [ { "value": 0, "scriptpubkey": "6a06d77d177601ff", "scriptpubkey_address": "", "scriptpubkey_asm": "OP_RETURN OP_PUSHBYTES_6 d77d177601ff", "scriptpubkey_type": "op_return" }, { "value": 5000000000, "scriptpubkey": "00140d1aba74bae35cd81edb909ec6a8847823f5cf58", "scriptpubkey_address": "tb1qp5dt5a96udwds8kmjz0vd2yy0q3ltn6cx56dy7", "scriptpubkey_asm": "OP_0 OP_PUSHBYTES_20 0d1aba74bae35cd81edb909ec6a8847823f5cf58", "scriptpubkey_type": "v0_p2wpkh" }, { "value": 0, "scriptpubkey": "6a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf94c70ecc7daa2000247304402203cf68802e97050cd98815ac57cf6a09585a2833f5d66f7a696e2b9fa04c8628902205079d5d3327d5e1ee14974e66fcb72be24ef1872ee99cf922826fd740ff3500501210360a9e39c533bd8222088de8cb20aabccafac41627a76291bc6166b7988b11481", "scriptpubkey_address": "", "scriptpubkey_asm": "OP_RETURN OP_PUSHBYTES_36 aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf9 OP_PUSHDATA1 ecc7daa2000247304402203cf68802e97050cd98815ac57cf6a09585a2833f5d66f7a696e2b9fa04c8628902205079d5d3327d5e1ee14974e66fcb72be24ef1872ee99cf922826fd740ff3500501210360a9e39c533bd8222088de8cb20aabccafac41627a76291bc6166b7988b11481", "scriptpubkey_type": "op_return" } ], "status": { "confirmed": true, "block_height": 6641, "block_hash": "0000025a4222d1c99aab47a04c4e9388fb2643023d83fe4e5beb99260f5ae6f9", "block_time": 1737030431 } }