bitcoin-sv / merchantapi-reference

Merchant API reference implementation
Other
23 stars 17 forks source link

SubmitTransaction returns embedded double quoted txid. #4

Closed ghost closed 4 years ago

ghost commented 4 years ago

Problem:

SubmitTransaction returns embedded double quoted txid. The spec excludes the double quotes. https://github.com/bitcoin-sv-specs/brfc-merchantapi#returns-1

Sample response on successful POST /mapi/tx

{
    "payload": "{\"apiVersion\":\"0.1.0\",\"timestamp\":\"2020-06-10T06:00:22.176Z\",\"txid\":\"\\\"3135d9b89f0295a26f726abac282111b8686f1fbd5093c9e40fe96c4cfe05faf\\\"\",\"returnResult\":\"success\",\"resultDescription\":\"\",\"minerId\":null,\"currentHighestBlockHash\":\"000000000000000002fc98b91a5adcbda91b37abf68ec2be4d1caddae2e621ab\",\"currentHighestBlockHeight\":638720,\"txSecondMempoolExpiry\":0}",
    "signature": null,
    "publicKey": null,
    "encoding": "UTF-8",
    "mimetype": "application/json"
}

Notice the nested double quotes around the txid value

Expected result:

txid contains a transaction id without the unnecessary double quotes.

\"txid\":\"3135d9b89f0295a26f726abac282111b8686f1fbd5093c9e40fe96c4cfe05faf\"

Actual Result:

txid contains a transaction id with unnecessary double quotes.

\"txid\":\"\\\"3135d9b89f0295a26f726abac282111b8686f1fbd5093c9e40fe96c4cfe05faf\\\"\"

{
    "payload": "{\"apiVersion\":\"0.1.0\",\"timestamp\":\"2020-06-10T06:00:22.176Z\",\"txid\":\"\\\"3135d9b89f0295a26f726abac282111b8686f1fbd5093c9e40fe96c4cfe05faf\\\"\",\"returnResult\":\"success\",\"resultDescription\":\"\",\"minerId\":null,\"currentHighestBlockHash\":\"000000000000000002fc98b91a5adcbda91b37abf68ec2be4d1caddae2e621ab\",\"currentHighestBlockHeight\":638720,\"txSecondMempoolExpiry\":0}",
    "signature": null,
    "publicKey": null,
    "encoding": "UTF-8",
    "mimetype": "application/json"
}
ghost commented 4 years ago

@jadwahab Can you please confirm if this is acceptable? Spec: https://github.com/bitcoin-sv-specs/brfc-merchantapi#returns-1

Thanks JeffChen, Unwriter and Libitx for reporting this issue.