Dash - Reinventing Cryptocurrency
Go to file
pasta 10bdb871e9
Merge #6450: feat: show human friendly error if missing spentindex, txindex or addressindex
a275bda266 refactor: removed duplicated code with errors messages for txindex, timestampindex, spentindex (Konstantin Akimov)
dd1b36636c feat: show human friendly error if missing spentindex, txindex or addressindex (Konstantin Akimov)

Pull request description:

  ## Issue being fixed or feature implemented

  Currently user receive error `Unable to get spent info` or even worse `No information available for address` which doesn't say anything about required extra indexes.

  Also, every call of RPC `getrawtransaction` causes this error logs on high level if spent index is disabled, but actually it just means that no couple extra fields are hidden in output which is expected if no index.

      node0 2024-12-03T18:54:33.349605Z [      http] [httpserver.cpp:248] [http_request_cb] [http] Received a POST request for / from 127.0.0.1:40052
      node0 2024-12-03T18:54:33.349634Z [httpworker.3] [rpc/request.cpp:180] [parse] [rpc] ThreadRPCServer method=getrawtransaction user=__cookie__
      node0 2024-12-03T18:54:33.349729Z [httpworker.3] [util/system.h:57] [error] ERROR: Spent index not enabled
      node0 2024-12-03T18:54:33.349735Z [httpworker.3] [util/system.h:57] [error] ERROR: Spent index not enabled
      node0 2024-12-03T18:54:33.349738Z [httpworker.3] [util/system.h:57] [error] ERROR: Spent index not enabled
      node0 2024-12-03T18:54:33.349808Z [httpworker.3] [httprpc.cpp:93] [~RpcHttpRequest] [bench] HTTP RPC request handled: user=__cookie__ command=getrawtransaction external=false status=200 elapsed_time_ms=0
      node0 2024-12-03T18:54:33.349998Z [      http] [httpserver.cpp:248] [http_request_cb] [http] Received a POST request for / from 127.0.0.1:40052
      node0 2024-12-03T18:54:33.350027Z [httpworker.0] [rpc/request.cpp:180] [parse] [rpc] ThreadRPCServer method=getrawtransaction user=__cookie__
      node0 2024-12-03T18:54:33.350128Z [httpworker.0] [util/system.h:57] [error] ERROR: Spent index not enabled
      node0 2024-12-03T18:54:33.350133Z [httpworker.0] [util/system.h:57] [error] ERROR: Spent index not enabled
      node0 2024-12-03T18:54:33.350137Z [httpworker.0] [util/system.h:57] [error] ERROR: Spent index not enabled

  ## What was done?
  Improved all usages of extra indexes `spentindex`, `txindex` and `addressindex` in RPC implementation.

  Affected RPCc:
   - getaddressmempool
   - getaddressutxos
   - getaddressdeltas
   - getaddressbalance
   - getaddresstxids
   - getspentinfo
   - getblockhashes

  ## How Has This Been Tested?
  Run unit&functional tests.
  ```
  $ dash-cli getaddressutxos '["yW4kiSd2pytXC2erbjm6crt1PGBvbwS4YX"]'
  Address index is disabled. You should run Dash Core with -addressindex (requires reindex) (code -32600)
  ```

  Check logs after calling getrawtransaction:
  ```
      node0 2024-12-03T19:10:00.378770Z [httpworker.3] [rpc/request.cpp:180] [parse] [rpc] ThreadRPCServer method=getrawtransaction user=__cookie__
      node0 2024-12-03T19:10:00.378861Z [httpworker.3] [httprpc.cpp:93] [~RpcHttpRequest] [bench] HTTP RPC request handled: user=__cookie__ command=getrawtransaction external=false status=500 elapsed_time_ms=0
      node0 2024-12-03T19:10:00.379017Z [      http] [httpserver.cpp:248] [http_request_cb] [http] Received a POST request for / from 127.0.0.1:44984
      node0 2024-12-03T19:10:00.379036Z [httpworker.0] [rpc/request.cpp:180] [parse] [rpc] ThreadRPCServer method=getrawtransaction user=__cookie__
      node0 2024-12-03T19:10:00.379090Z [httpworker.0] [httprpc.cpp:93] [~RpcHttpRequest] [bench] HTTP RPC request handled: user=__cookie__ command=getrawtransaction external=false status=500 elapsed_time_ms=0
      node0 2024-12-03T19:10:00.379240Z [      http] [httpserver.cpp:248] [http_request_cb] [http] Received a POST request for / from 127.0.0.1:44984
  ```

  ## Breaking Changes
  Error type and message changed. It's no more `RPC_INVALID_ADDRESS_OR_KEY` but `RPC_INVALID_REQUEST`.

  ## Checklist:
  - [x] I have performed a self-review of my own code
  - [x] I have commented my code, particularly in hard-to-understand areas
  - [x] I have added or updated relevant unit/integration/functional/e2e tests
  - [x] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  kwvg:
    utACK a275bda266
  UdjinM6:
    utACK a275bda266

Tree-SHA512: d53373aba794035173375811e333e940efb1081bed46e18846b2b54d60036ee52487c65f9b84ac687b2be2a30f3a68fb75afbb2c89e52b0774740892863a04df
2024-12-11 08:19:30 -06:00
.github Squashed 'src/dashbls/' changes from 4e070243ae..7e747e8a07 2024-12-04 16:04:26 +00:00
.tx fix: follow-up #5393 - should be used [dash.dash_ents] (#5472) 2023-07-01 14:16:50 +03:00
build-aux/m4 Merge bitcoin/bitcoin#29859: build: Fix false positive CHECK_ATOMIC test 2024-10-26 12:29:51 -05:00
ci partial bitcoin#25288: Reliably don't start itself (lint-all.py runs all tests twice) 2024-12-04 15:55:11 +00:00
contrib merge bitcoin#23506: Make more shell scripts verifiable by the shellcheck tool 2024-12-04 15:55:11 +00:00
depends merge bitcoin#30198: qt 5.15.14 and fix macOS build with Clang 18 2024-11-17 07:42:09 +00:00
doc Merge #6325: feat: start DIP0024 from block 1 - fire up test chains by first block - 7/n 2024-12-10 09:43:02 -06:00
share merge bitcoin#27676: Bump minimum required runtime version and prepare for building with upstream LLVM 2024-11-13 11:07:38 +00:00
src Merge #6450: feat: show human friendly error if missing spentindex, txindex or addressindex 2024-12-11 08:19:30 -06:00
test Merge #6466: backport: merge bitcoin#18642, #25102, #25100, #25157, #25101, #25245, #25456, #24697, #24662, #25499 (clock backports) 2024-12-10 22:27:43 -06:00
.cirrus.yml merge bitcoin#27676: Bump minimum required runtime version and prepare for building with upstream LLVM 2024-11-13 11:07:38 +00:00
.dockerignore build: add dash minimal development environment container 2021-12-21 12:43:37 +05:30
.editorconfig Merge #21123: code style: Add EditorConfig file 2021-07-16 10:04:09 -05:00
.gitattributes Separate protocol versioning from clientversion 2014-10-29 00:24:40 -04:00
.gitignore merge bitcoin#24031: don't compress macOS DMG 2024-11-06 19:22:01 +00:00
.gitlab-ci.yml merge bitcoin#28622: use macOS 14 SDK (Xcode 15.0) 2024-11-16 02:24:19 +00:00
.python-version partial Merge bitcoin/bitcoin#28210: build: Bump clang minimum supported version to 13 2024-10-06 13:36:27 -05:00
.style.yapf Merge bitcoin/bitcoin#27802: Update .style.yapf 2024-10-25 09:12:00 -05:00
autogen.sh Merge bitcoin/bitcoin#27875: build: make sure we can overwrite config.{guess,sub} before doing so 2024-10-25 09:12:01 -05:00
CMakeLists.txt Squashed 'src/immer/' changes from 9cb6a5a845..5875f7739a 2024-11-02 17:50:50 +00:00
configure.ac Squashed 'src/dashbls/' changes from 4e070243ae..7e747e8a07 2024-12-04 16:04:26 +00:00
CONTRIBUTING.md Merge #6220: backport: Merge bitcoin#18448,24433, 24139, 23001, (partial) 24339, (partial) core/gui#420 2024-09-27 12:29:08 -05:00
COPYING docs: update license year range to 2024 (#5890) 2024-02-22 20:56:43 -06:00
INSTALL.md Dashify INSTALL.md and build-unix.md 2018-01-12 16:12:54 +01:00
libdashconsensus.pc.in revert dash#1432: Rename consensus source library and API 2022-08-09 14:16:28 +05:30
Makefile.am merge bitcoin#22861: Update test README and lint script 2024-11-27 04:55:46 +00:00
README.md doc: make build steps more prominent 2024-07-18 01:22:42 -06:00
SECURITY.md docs: update supported versions in SECURITY.md 2024-12-07 07:58:19 +00:00

Dash Core staging tree

CI master develop
Gitlab Build Status Build Status

https://www.dash.org

For an immediately usable, binary version of the Dash Core software, see https://www.dash.org/downloads/.

Further information about Dash Core is available in ./doc/.

What is Dash?

Dash is an experimental digital currency that enables instant, private payments to anyone, anywhere in the world. Dash uses peer-to-peer technology to operate with no central authority: managing transactions and issuing money are carried out collectively by the network. Dash Core is the name of the open source software which enables the use of this currency.

For more information read the original Dash whitepaper.

License

Dash Core is released under the terms of the MIT license. See COPYING for more information or see https://opensource.org/licenses/MIT.

Development Process

The master branch is meant to be stable. Development is normally done in separate branches. Tags are created to indicate new official, stable release versions of Dash Core.

The develop branch is regularly built (see doc/build-*.md for instructions) and tested, but is not guaranteed to be completely stable.

The contribution workflow is described in CONTRIBUTING.md and useful hints for developers can be found in doc/developer-notes.md.

Build / Compile from Source

The ./configure, make, and cmake steps, as well as build dependencies, are in ./doc/ as well:

Testing

Testing and code review is the bottleneck for development; we get more pull requests than we can review and test on short notice. Please be patient and help out by testing other people's pull requests, and remember this is a security-critical project where any mistake might cost people lots of money.

Automated Testing

Developers are strongly encouraged to write unit tests for new code, and to submit new unit tests for old code. Unit tests can be compiled and run (assuming they weren't disabled in configure) with: make check. Further details on running and extending unit tests can be found in /src/test/README.md.

There are also regression and integration tests, written in Python. These tests can be run (if the test dependencies are installed) with: test/functional/test_runner.py

The CI (Continuous Integration) systems make sure that every pull request is built for Windows, Linux, and macOS, and that unit/sanity tests are run automatically.

Manual Quality Assurance (QA) Testing

Changes should be tested by somebody other than the developer who wrote the code. This is especially important for large or high-risk changes. It is useful to add a test plan to the pull request description if testing the changes is not straightforward.

Translations

Changes to translations as well as new translations can be submitted to Dash Core's Transifex page.

Translations are periodically pulled from Transifex and merged into the git repository. See the translation process for details on how this works.

Important: We do not accept translation changes as GitHub pull requests because the next pull from Transifex would automatically overwrite them again.