Page MenuHomePhabricator

[REST] Handle UTXO retrieval when ignoring the mempool
ClosedPublic

Authored by Fabien on Tue, Jul 30, 07:18.

Details

Reviewers
deadalnix
Group Reviewers
Restricted Project
Commits
rABCed91986205c2: [REST] Handle UTXO retrieval when ignoring the mempool
Summary
Current REST API always returns empty UTXO when invoked without
`/checkmempool/` URL part.

After the fix:

$ curl -s http://localhost:8332/rest/getutxos/0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098-0.json
| jq
{
  "chainHeight": 514109,
  "chaintipHash":
"0000000000000000001fe76d1445e8a6432fd2de04261dc9c5915311dc7ad6de",
  "bitmap": "1",
  "utxos": [
    {
      "height": 1,
      "value": 50,
      "scriptPubKey": {
        "asm": "0496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858ee
OP_CHECKSIG",
        "hex": "410496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858eeac",
        "reqSigs": 1,
        "type": "pubkey",
        "addresses": [
          "12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX"
        ]
      }
    }
  ]
}

Before the fix:

$ curl -s http://localhost:8332/rest/getutxos/0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098-0.json
| jq
{
  "chainHeight": 514109,
  "chaintipHash":
"0000000000000000001fe76d1445e8a6432fd2de04261dc9c5915311dc7ad6de",
  "bitmap": "0",
  "utxos": []
}

Backport of core PR12717
https://github.com/bitcoin/bitcoin/pull/12717/files

Test Plan
make check
./test/functional/test_runner.py interface_rest

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Fabien created this revision.Tue, Jul 30, 07:18
Herald added a reviewer: Restricted Project. · View Herald TranscriptTue, Jul 30, 07:18
deadalnix accepted this revision.Sun, Aug 4, 08:06
This revision is now accepted and ready to land.Sun, Aug 4, 08:06
This revision was automatically updated to reflect the committed changes.