Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

Accounts endpoint returning incorrect balance for subsequent queries #4260

Open
kss-espeo opened this issue Dec 2, 2019 · 0 comments
Open

Comments

@kss-espeo
Copy link

kss-espeo commented Dec 2, 2019

I query Cardano Node to retrieve address index for my account using following method: https://cardanodocs.com/technical/wallet/api/v1/?v=1.6.0#section/Getting-Started/Receiving-ADA

This returns correct balance value of my wallet (amount field) :

[
  {
    "index": 2147483648,
    "addresses": [
      {
        "id": "37btjrVyb4KFv3siBTNTg2Y3mLvpBz2Ti9wNpi2Nr7qPQ8YQ2n3NRaT7Q6w4amNTCyv3YUiTK97DvWLQoAXFR9KoT7z8hUkwAHDiYWvrBMQgSbvEBY",
        "used": true,
        "changeAddress": false,
        "ownership": "isOurs"
      },
      {
        "id": "37btjrVyb4KGCAUEDGrfX6khonF8AdDr4VavmpLGeb5574WeYuSFxJwvvNRG3u1qb2z9Sx61MNsQjyiBMXRKbCyC4NQo1v8LWNrhDa1f555F7AUtbu",
        "used": true,
        "changeAddress": true,
        "ownership": "isOurs"
      },
      ...more addresses here...
      {
        "id": "37btjrVyb4KCRFoncLWaeJR7FWGCRN89drYw4Gq4TUheKsskAoQb6ic6oh1FdivGb8keB463iwxbhSRrYwc5jfvVuUZfi2x1MBuehqZeM4aUy3EmwT",
        "used": true,
        "changeAddress": true,
        "ownership": "isOurs"
      }
    ],
    "amount": 2113308647,
    "name": "Account: HdAccountIx 2147483648",
    "walletId": "2cWKMJemoBajhKSbMFvjrfiDSUg7vyASiBejRirc8qFDMcTyvSrn5nnzPXo498CuZtLe2"
  }
]

Then, I use https://cardanodocs.com/technical/wallet/api/v1/?v=1.6.0#section/Getting-Started/Sending-ADA to send a transaction from that address. It is successfully sent.

And then, I am trying to do exactly the same thing again. However, https://cardanodocs.com/technical/wallet/api/v1/?v=1.6.0#section/Getting-Started/Receiving-ADA incorrectly returns 0 balance this time:

[
  {
    "index": 2147483648,
    "addresses": [
      {
        "id": "37btjrVyb4KFv3siBTNTg2Y3mLvpBz2Ti9wNpi2Nr7qPQ8YQ2n3NRaT7Q6w4amNTCyv3YUiTK97DvWLQoAXFR9KoT7z8hUkwAHDiYWvrBMQgSbvEBY",
        "used": true,
        "changeAddress": false,
        "ownership": "isOurs"
      },
      {
        "id": "37btjrVyb4KGCAUEDGrfX6khonF8AdDr4VavmpLGeb5574WeYuSFxJwvvNRG3u1qb2z9Sx61MNsQjyiBMXRKbCyC4NQo1v8LWNrhDa1f555F7AUtbu",
        "used": true,
        "changeAddress": true,
        "ownership": "isOurs"
      },
      ...more addresses here...
      {
        "id": "37btjrVyb4KG2s4YW3PD6o5LG7BeQNFrAV9NCuTAoXmafjinvAiN4byrfA2YbXTXafASPoSwFsApdD9KAciuUVVHthh9L1bvffTFpu4JDJ36VoEYxD",
        "used": false,
        "changeAddress": false,
        "ownership": "isOurs"
      },
      ...more addresses here...
      {
        "id": "37btjrVyb4KCRFoncLWaeJR7FWGCRN89drYw4Gq4TUheKsskAoQb6ic6oh1FdivGb8keB463iwxbhSRrYwc5jfvVuUZfi2x1MBuehqZeM4aUy3EmwT",
        "used": true,
        "changeAddress": true,
        "ownership": "isOurs"
      }
    ],
    "amount": 0,
    "name": "Account: HdAccountIx 2147483648",
    "walletId": "2cWKMJemoBajhKSbMFvjrfiDSUg7vyASiBejRirc8qFDMcTyvSrn5nnzPXo498CuZtLe2"
  }
]

Please do note that is also returned an additional address with used flag set to false.

Funny thing is, if I wait some time (couple of seconds) , hitting exactly the same endpoint with exactly the same data returns correct balance.

What is happening there? Looks like a bug to me, but it may also be my poor understanding of Cardano ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant