pybitcash/bitcash

Unable to send more than one transaction within a block

Closed this issue · 2 comments

The UTXO list from the Actorforth API is incorrect when a transaction is pending (in mempool).

Example:

Upon sending a single transaction 555fc34812eb83e64d9f488b1091c5668ad49a11618c2e9debf573f3d5d0b96a from the address qrjluzvef02tz5czm5u90jkdalte8qldyqc7afjlsd to the same address, the following UTXOs are returned by Actorforth:

{
  "utxos": [
    {
      "height": 801429,
      "txid": "ac6ff11bcdcfcfdaa043c1eadcca915b96e4aa12d9044e5ebfcb87bc648faa5e",
      "vout": 0,
      "satoshis": 187709,
      "amount": 0.00187709,
      "confirmations": 433
    },
    {
      "height": 0,
      "txid": "555fc34812eb83e64d9f488b1091c5668ad49a11618c2e9debf573f3d5d0b96a",
      "vout": 0,
      "satoshis": 187517,
      "amount": 0.00187517,
      "confirmations": 0
    }
  ],
  "legacyAddress": "1My64mJNQy9dDa1zaJzJfaqjB5QFRfNzsi",
  "cashAddress": "bitcoincash:qrjluzvef02tz5czm5u90jkdalte8qldyqc7afjlsd",
  "slpAddress": "simpleledger:qrjluzvef02tz5czm5u90jkdalte8qldyq59kj8lwn",
  "scriptPubKey": "76a914e5fe09994bd4b15302dd3857cacdefd79383ed2088ac",
  "asm": "OP_DUP OP_HASH160 e5fe09994bd4b15302dd3857cacdefd79383ed20 OP_EQUALVERIFY OP_CHECKSIG"
}

The correct output should be:

{
  "utxos": [
    {
      "height": 0,
      "txid": "555fc34812eb83e64d9f488b1091c5668ad49a11618c2e9debf573f3d5d0b96a",
      "vout": 0,
      "satoshis": 187517,
      "amount": 0.00187517,
      "confirmations": 0
    }
  ],
  "legacyAddress": "1My64mJNQy9dDa1zaJzJfaqjB5QFRfNzsi",
  "cashAddress": "bitcoincash:qrjluzvef02tz5czm5u90jkdalte8qldyqc7afjlsd",
  "slpAddress": "simpleledger:qrjluzvef02tz5czm5u90jkdalte8qldyq59kj8lwn",
  "scriptPubKey": "76a914e5fe09994bd4b15302dd3857cacdefd79383ed2088ac",
  "asm": "OP_DUP OP_HASH160 e5fe09994bd4b15302dd3857cacdefd79383ed20 OP_EQUALVERIFY OP_CHECKSIG"
}

as the UTXO from ac6ff11bcdcfcfdaa043c1eadcca915b96e4aa12d9044e5ebfcb87bc648faa5e is already spent.

Context

This issue starting appearing shortly after the May 2023 network upgrade. Actorforth's service went down because they did not upgrade their BCHN node. They upgraded it shortly after the outage was reported to them and went back online.

However, the UTXO issue was noticed shortly after, and they told me that they did not change their indexer and API codebase.

PR #122 replaces the UTXO endpoint with chaingraph, fixing this issue.

Fixed in #122