bitcoin/doc
Samuel Dobson bdda137878
Merge #16766: wallet: Make IsTrusted scan parents recursively
4671fc3d9e Expand on wallet_balance.py comment from https://github.com/bitcoin/bitcoin/pull/16766\#issuecomment-527563982 (Jeremy Rubin)
91f3073f08 Update release notes to mention changes to IsTrusted and impact on wallet (Jeremy Rubin)
8f174ef112 Systematize style of IsTrusted single line if (Jeremy Rubin)
b49dcbedf7 update variable naming conventions for IsTrusted (Jeremy Rubin)
5ffe0d1449 Update comment in test/functional/wallet_balance.py (Jeremy Rubin)
a550c58267 Update wallet_balance.py test to reflect new behavior (Jeremy Rubin)
5dd7da4ccd Reuse trustedParents in looped calls to IsTrusted (Jeremy Rubin)
595f09d6de Cache tx Trust per-call to avoid DoS (Jeremy Rubin)
dce032ce29 Make IsTrusted scan parents recursively (Jeremy Rubin)

Pull request description:

  This slightly modifies the behavior of IsTrusted to recursively check the parents of a transaction. Otherwise, it's possible that a parent is not IsTrusted but a child is. If a parent is not trusted, then a child should not be either.

  This recursive scan can be a little expensive, so ~it might be beneficial to have a way of caching IsTrusted state, but this is a little complex because various conditions can change between calls to IsTrusted (e.g., re-org).~ I added a cache which works per call/across calls, but does not store the results semi-permanently. Which reduces DoS risk of this change. There is no risk of untrusted parents causing a resource exploitation, as we immediately return once that is detected.

  This is a change that came up as a bug-fix esque change while working on OP_SECURETHEBAG. You can see the branch where this change is important here: https://github.com/bitcoin/bitcoin/compare/master...JeremyRubin:stb-with-rpc?expand=1. Essentially, without this change, we can be tricked into accepting an OP_SECURETHEBAG output because we don't properly check the parents. As this was a change which, on its own, was not dependent on OP_SECURETHEBAG, I broke it out as I felt the change stands on its own by fixing a long standing wallet bug.

  The test wallet_balance.py has been corrected to meet the new behavior. The below comment, reproduced, explains what the issue is and the edge cases that can arise before this change.

          # Before `test_balance()`, we have had two nodes with a balance of 50
          # each and then we:
          #
          # 1) Sent 40 from node A to node B with fee 0.01
          # 2) Sent 60 from node B to node A with fee 0.01
          #
          # Then we check the balances:
          #
          # 1) As is
          # 2) With transaction 2 from above with 2x the fee
          #
          # Prior to #16766, in this situation, the node would immediately report
          # a balance of 30 on node B as unconfirmed and trusted.
          #
          # After #16766, we show that balance as unconfirmed.
          #
          # The balance is indeed "trusted" and "confirmed" insofar as removing
          # the mempool transactions would return at least that much money. But
          # the algorithm after #16766 marks it as unconfirmed because the 'taint'
          # tracking of transaction trust for summing balances doesn't consider
          # which inputs belong to a user. In this case, the change output in
          # question could be "destroyed" by replace the 1st transaction above.
          #
          # The post #16766 behavior is correct; we shouldn't be treating those
          # funds as confirmed. If you want to rely on that specific UTXO existing
          # which has given you that balance, you cannot, as a third party
          # spending the other input would destroy that unconfirmed.
          #
          # For example, if the test transactions were:
          #
          # 1) Sent 40 from node A to node B with fee 0.01
          # 2) Sent 10 from node B to node A with fee 0.01
          #
          # Then our node would report a confirmed balance of 40 + 50 - 10 = 80
          # BTC, which is more than would be available if transaction 1 were
          # replaced.

  The release notes have been updated to note the new behavior.

ACKs for top commit:
  ariard:
    Code Review ACK 4671fc3, maybe extend DoS protection in a follow-up PR.
  fjahr:
    Code review ACK 4671fc3d9e
  ryanofsky:
    Code review ACK 4671fc3d9e. Changes since last review: 2 new commits adding suggested release note and python test comment, also a clean rebase with no changes to the earlier commits. The PR description is more comprehensive now, too. Looks good!
  promag:
    Code review ACK 4671fc3d9e.

Tree-SHA512: 6b183ff425304fef49724290053514cb2770f4a2350dcb83660ef24af5c54f7c4c2c345b0f62bba60eb2d2f70625ee61a7fab76a7f491bb5a84be5c4cc86b92f
2019-11-05 21:59:27 +13:00
..
man p2p: Remove BIP61 reject messages 2019-10-02 10:39:14 -04:00
release-notes Doc: move detached release notes into release-notes.md 2019-08-22 13:21:41 -10:00
.gitignore
assets-attribution.md
benchmarking.md [doc] fix Makefile target in benchmarking.md 2019-10-08 22:14:04 +02:00
bips.md doc: update bips.md with buried BIP9 deployments 2019-10-11 15:42:30 -04:00
bitcoin_logo_doxygen.png
bitcoin-conf.md doc: add default bitcoin.conf locations 2019-08-19 19:34:57 +02:00
build-freebsd.md doc: update FreeBSD build guide for 12.0 2019-02-15 19:54:59 +08:00
build-netbsd.md doc: update NetBSD build instructions for 8.0 2018-12-13 12:05:45 +08:00
build-openbsd.md Merge #14515: doc: Update OpenBSD build guide for 6.4 2018-11-05 13:26:37 +01:00
build-osx.md doc: specify protobuf as optional in build docs 2019-09-12 20:28:53 +10:00
build-unix.md docs: remove protobuf from docs 2019-10-24 16:01:42 -04:00
build-windows.md doc: compiling with Visual Studio is now supported on Windows 2019-11-01 15:25:52 -04:00
dependencies.md docs: remove protobuf from docs 2019-10-24 16:01:42 -04:00
descriptors.md Update descriptors.md to include sortedmulti 2019-10-08 13:56:56 -04:00
developer-notes.md doc: Fix some misspellings 2019-11-04 04:22:53 -05:00
dnsseed-policy.md
Doxyfile.in doc: Move doxygen intro to file for USE_MDFILE_AS_MANPAGE 2019-09-23 19:22:06 -04:00
files.md doc: Add missing indexes/blockfilter/basic/ to doc/files.md 2019-10-11 08:31:18 -04:00
fuzzing.md docs: Add undefined to --with-sanitizers=fuzzer,address 2019-10-30 13:34:10 +00:00
gitian-building.md
init.md doc: Fix whitespace errs in .md files, bitcoin.conf, Info.plist.in, and find_bdb48.m4 2019-09-17 03:21:22 -04:00
JSON-RPC-interface.md doc: Clarify RPC versioning 2019-04-15 11:20:16 -04:00
productivity.md docs: Add productivity notes for "dummy rebases" 2019-05-15 14:12:45 -04:00
psbt.md doc: fix/improve analyzepsbt in doc/psbt.md 2019-05-19 17:31:37 +02:00
rapidcheck.md doc: initial RapidCheck property-based testing documentation 2019-08-19 09:18:16 +02:00
README_doxygen.md doc: Improve doxygen readme navigation section 2019-09-23 19:22:06 -04:00
README_windows.txt
README.md docs: add reduce-memory.md 2019-07-06 10:45:04 +08:00
reduce-memory.md docs: add reduce-memory.md 2019-07-06 10:45:04 +08:00
reduce-traffic.md doc: Mention blocksonly in reduce-traffic.md, unhide option 2019-05-13 10:44:46 -04:00
release-notes-15437.md [docs] Add release notes for removal of REJECT reasons 2019-10-10 13:31:57 -04:00
release-notes-17056.md Add release note 2019-10-08 13:56:56 -04:00
release-notes.md Update release notes to mention changes to IsTrusted and impact on wallet 2019-10-21 13:22:56 -07:00
release-process.md doc: move-only: Steps for "before major release branch-off" 2019-10-02 09:36:49 -04:00
REST-interface.md doc: Remove explicit network name references 2019-11-01 12:06:35 +01:00
shared-libraries.md doc: correct bitcoinconsensus_version in shared-libraries 2019-04-07 21:42:32 +08:00
tor.md Elaborate on the need to re-login on Debian-based systems to use tor following usermod 2019-09-12 08:27:03 -05:00
translation_process.md build: Factor out qt translations from build system 2019-09-29 14:24:54 +02:00
translation_strings_policy.md A few textual improvements 2019-02-08 09:47:50 +01:00
zmq.md doc: Add note regarding ZMQ block notification 2019-08-19 01:05:58 +01:00

Bitcoin Core

Setup

Bitcoin Core is the original Bitcoin client and it builds the backbone of the network. It downloads and, by default, stores the entire history of Bitcoin transactions, which requires a few hundred gigabytes of disk space. Depending on the speed of your computer and network connection, the synchronization process can take anywhere from a few hours to a day or more.

To download Bitcoin Core, visit bitcoincore.org.

Running

The following are some helpful notes on how to run Bitcoin Core on your native platform.

Unix

Unpack the files into a directory and run:

  • bin/bitcoin-qt (GUI) or
  • bin/bitcoind (headless)

Windows

Unpack the files into a directory, and then run bitcoin-qt.exe.

macOS

Drag Bitcoin Core to your applications folder, and then run Bitcoin Core.

Need Help?

Building

The following are developer notes on how to build Bitcoin Core on your native platform. They are not complete guides, but include notes on the necessary libraries, compile flags, etc.

Development

The Bitcoin repo's root README contains relevant information on the development process and automated testing.

Resources

Miscellaneous

License

Distributed under the MIT software license. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. This product includes cryptographic software written by Eric Young (eay@cryptsoft.com), and UPnP software written by Thomas Bernard.