Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/peer/transactionsFromIds endpoint in the p2p api does not work #1910

Closed
alessiodf opened this issue Dec 25, 2018 · 0 comments
Closed

/peer/transactionsFromIds endpoint in the p2p api does not work #1910

alessiodf opened this issue Dec 25, 2018 · 0 comments

Comments

@alessiodf
Copy link
Contributor

alessiodf commented Dec 25, 2018

Describe the bug

There are issues with the /peer/transactionsFromIds endpoint in the p2p api:

  1. The ids values in the query string should be restricted to a comma delimited list of valid transaction IDs, namely 64 character hex values only. But due to an error in the regex, any value longer than 32 characters, including non-hex characters, is considered valid.

  2. Even if valid transaction ids are specified, the response contains an empty transactions array.

To Reproduce

For case 1, access an endpoint like so: /peer/transactionsFromIds?ids=12345678901234567890123456789012abcxyz!(accepted as valid when it shouldn't be)

For case 2, access an endpoint like so: /peer/transactionsFromIds?ids=098193e5b51fd172ed23b2b849851ab63b9e00b648343dab5fbc31ed5932a4ae (this is a valid tx on devnet but yields an empty array in the response if the request is sent to a devnet peer).

In both cases, the api erroneously responds with the following:

{
    "success": true,
    "transactions": [
        null
    ]
}

Expected behaviour

For case 1, the id should be not be processed as it should fail the regex check.

For case 2, the transaction information should be returned. Using the example tx above from devnet, the following is expected:

{
    "success": true,
    "transactions": [
        {
            "version": 1,
            "network": 30,
            "type": 0,
            "timestamp": 55634402,
            "senderPublicKey": "02d2f48a7ebb5b6d484de15b4cab8ab13c1d39b7141301efe048714aa9d82eb1cd",
            "fee": "350000",
            "vendorFieldHex": "64617465645f746573745f64656c2078205442572026204661697220466565732e",
            "amount": "938081198",
            "expiration": 0,
            "recipientId": "DPMnuMpEaxYrNHQ5tiKRWrMDXsr3uZBsHJ",
            "signature": "304402202bb1fa38c8e3082bf9cd7fee9f7096768a455f8759bc377d45d9e1767d710efb02202f1618e485678acd6f78454a7e90cd591874361266a663ebbfe30c74d50e489a",
            "vendorField": "dated_test_del x TBW & Fair Fees.",
            "id": "098193e5b51fd172ed23b2b849851ab63b9e00b648343dab5fbc31ed5932a4ae",
            "verified": true,
            "blockId": "7480967330326361759",
            "senderId": "DJ8K2tb6DxbZNmQRpmtkTtAr6rM7y1PWkA"
        }
    ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant