Bitcoin-com / rest.bitcoin.com

Bitcoin.com's Cloud's REST API
https://rest.bitcoin.com
MIT License
19 stars 26 forks source link

GET /slp/txDetails/{txid} return traceback data #521

Open dtokens opened 4 years ago

dtokens commented 4 years ago

Call /slp/txDetails/d70af8576a059b24d831450ea9e4f6c192089212fc7469e3a51d2a771362e5d8 returns traceback data:

{
  "error": "TypeError: Cannot read property 'in' of undefined\n    at 
/var/www/rest.bitcoin.com/dist/routes/v2/slp.js:1924:34\n    at step 
(/var/www/rest.bitcoin.com/dist/routes/v2/slp.js:43:23)\n    at Object.next 
(/var/www/rest.bitcoin.com/dist/routes/v2/slp.js:24:53)\n    at 
/var/www/rest.bitcoin.com/dist/routes/v2/slp.js:18:71\n    at new Promise 
(<anonymous>)\n    at __awaiter 
(/var/www/rest.bitcoin.com/dist/routes/v2/slp.js:14:12)\n    at formatToRestObject 
(/var/www/rest.bitcoin.com/dist/routes/v2/slp.js:1917:12)\n    at 
/var/www/rest.bitcoin.com/dist/routes/v2/slp.js:1844:42\n    at step 
(/var/www/rest.bitcoin.com/dist/routes/v2/slp.js:43:23)\n    at Object.next 
(/var/www/rest.bitcoin.com/dist/routes/v2/slp.js:24:53)"

}
christroutner commented 4 years ago

This issue needs further investigation:

christroutner commented 4 years ago

The reason the traceback error message is displayed is because the TXID is not an SLP transaction.

Here is the endpoint which re-creates this issue: https://rest.bitcoin.com/v2/slp/txDetails/d70af8576a059b24d831450ea9e4f6c192089212fc7469e3a51d2a771362e5d8

Here on the block explorer you can see that this is not an SLP transaction: https://explorer.bitcoin.com/bch/tx/d70af8576a059b24d831450ea9e4f6c192089212fc7469e3a51d2a771362e5d8

christroutner commented 4 years ago

The scope of this issue is update the /v2/slp/txDetails/ endpoint to return an error message like 'not an slp transaction' in this scenario. Any PR fixing this issue should include unit and integration tests for this use case.