Commit graph

31712 commits

Author SHA1 Message Date
W. J. van der Laan
aecc08f62e
Merge bitcoin/bitcoin#23409: refactor: Take Span in SetSeed
fa93ef5a8a refactor: Take Span in SetSeed (MarcoFalke)

Pull request description:

  This makes calling code less verbose and less fragile. Also, by adding
  the CKey::data() member function, it is now possible to call HexStr()
  with a CKey object.

ACKs for top commit:
  sipa:
    utACK fa93ef5a8a
  laanwj:
    Code review ACK fa93ef5a8a
  theStack:
    Code-review ACK fa93ef5a8a

Tree-SHA512: 73fb999320719ad4b9ab5544018a7a083d140545c2807ee3582ecf7f441040a30b5157e85790b6b840af82f002a7faf30bd8162ebba5caaf2067391c43dc7e25
2021-11-08 12:48:25 +01:00
Tim Ruffing
90f1f849e9 doc: Suggest keys.openpgp.org as keyserver in SECURITY.md
This is in line with 4c43b7d41d from
PR #22688.
2021-11-08 12:22:04 +01:00
MarcoFalke
c86f546f98
Merge bitcoin/bitcoin#23458: ci: Do not print git log for empty COMMIT_RANGE
095f07744c ci: Do not print `git log` for empty COMMIT_RANGE (Hennadii Stepanov)

Pull request description:

  On master (77a2f5d30c) a CI lint task [log](https://api.cirrus-ci.com/v1/task/4817858858319872/logs/lint.log) exceeds 20K lines.

  This PR fixes this issue.

ACKs for top commit:
  MarcoFalke:
    cr ACK 095f07744c

Tree-SHA512: 89180018aeccf1599cdf218924cbab12dcbae0f6674bb90e13b64e342cdd908a880b885039c23f0d1d03493e55a94fe04abf39481616ae6550c6a759f5ca9a35
2021-11-08 09:32:11 +01:00
MarcoFalke
f075e83b81
Merge bitcoin/bitcoin#23439: test: Open streams_test_tmp file in temporary folder
a04350b86c Open streams_test_tmp file in temporary folder (Martin Leitner-Ankerl)

Pull request description:

  The tests `streams_tests/streams_buffered_file` and `streams_tests/streams_buffered_file_rand`
  did not use a the temporary directory provided by  `BasicTestingSetup`, so it was not possible
  to execute multiple of them in parallel. This fixes that.

  To reproduce, run

  ```sh
  parallel --halt now,fail=1 './src/test/test_bitcoin --run_test=streams_tests/streams_buffered_file_rand' -- ::: {1..1000}
  ```

  This executes the test 1000 times, one job per CPU. It works on that commit but mergebase fails quickly.

ACKs for top commit:
  theStack:
    Tested ACK a04350b86c

Tree-SHA512: 705b127e99a0fdbf33362283cc94036ac3aeff364a5e75b0f0a2490114bbaa44cf310ac13d43c254a4b51b72d4e856e9ee584904ce56b2f496b92d995ac7dc24
2021-11-08 09:28:10 +01:00
fanquake
ed40f37e00
Merge bitcoin/bitcoin#22076: build: Fix make apk if ccache enabled, and enable it on CI
15fb57556e ci: Enable ccache for "ARM64 Android APK" job (Hennadii Stepanov)
7a777ec98c build: Fix `make apk` if ccache enabled (Hennadii Stepanov)

Pull request description:

  On master (456c8d6cd8) `make apk` is broken for Android targets if the build system was configured with `--enable-ccache` explicitly or by default.

  This PR fixes this bug, and enables `ccache` for "ARM64 Android APK" Cirrus CI job.

ACKs for top commit:
  fanquake:
    ACK 15fb57556e

Tree-SHA512: e3c94dccc9f07a712e0e01983462ee607122623b213173c74d17e91024243239de212a35e5db94036bfd0a347e727b133865c26c67d6bd279604416ea971ab94
2021-11-08 15:58:48 +08:00
fanquake
ddc90293c1
Merge bitcoin/bitcoin#23464: doc: remove mention of system univalue from build-unix.md
78e36700a0 doc: remove mention of system univalue (fanquake)

Pull request description:

  Should have been part of #22646.

ACKs for top commit:
  hebasto:
    ACK 78e36700a0

Tree-SHA512: a5d54d73526033825ce4467cc3c57c26064739eef546556975a4c6f1f5bea84004640acd426734f90f98bc7a76ec837d716aa31167f2bdce7ee3887ad92e3152
2021-11-08 15:43:47 +08:00
fanquake
170e2687ba
Merge bitcoin/bitcoin#23446: doc: Mention that BerkeleyDB is for legacy wallet in build-unix
7eb5b25e6e doc: Mention that BerkeleyDB is for legacy wallet in build-unix (W. J. van der Laan)

Pull request description:

  This updates build-unix for the descriptor wallet, and prepares for eventual legacy wallet deprecation.

  - Move 'descriptor wallet' dependencies above legacy wallet deps both for Debian and Fedora.
  - Explicitly mention 'legacy wallet' where referring to the BerkeleyDB wallet. Shorten BerkeleyDB instruction to a single paragraph.

ACKs for top commit:
  lsilva01:
    ACK 7eb5b25
  hebasto:
    ACK 7eb5b25e6e, I have reviewed the code and it looks OK, I agree it can be merged.

Tree-SHA512: 8a0859bfaf170a1c5a8b3e8f873d6b788f3b1cebd8d006569348c5b415d5ebbdfd56a5a294c509114975addb599da8a50c4be618b0545ff402065e948f692ba1
2021-11-08 15:42:23 +08:00
Hennadii Stepanov
15fb57556e
ci: Enable ccache for "ARM64 Android APK" job 2021-11-08 07:19:21 +02:00
Hennadii Stepanov
7a777ec98c
build: Fix make apk if ccache enabled 2021-11-08 07:19:10 +02:00
fanquake
78e36700a0
doc: remove mention of system univalue
Should have been part of #22646.
2021-11-08 10:06:40 +08:00
fanquake
f21ce0bbbe
Merge bitcoin/bitcoin#23450: doc: update SECURITY.md inline with recent changes to bitcoincore.org
e7c0d506d5 doc: update SECURITY.md inline with recent changes to bitcoincore.org (fanquake)

Pull request description:

  See https://github.com/bitcoin-core/bitcoincore.org/pull/809 and https://github.com/bitcoin-core/bitcoincore.org/pull/819 and https://bitcoincore.org/en/contact/.

ACKs for top commit:
  laanwj:
    ACK e7c0d506d5, also checked that fingerprint matches
  kristapsk:
    ACK e7c0d506d5, checked that fingerprint matches.
  Zero-1729:
    ACK e7c0d506d5, fingerprint matches.

Tree-SHA512: 24aeb5c107db55a006b848bfd2c0f644219975acbd21f30749aff6a506832471d43de388100bbb195d48bca6f799e95e6fd2c54e06fc26c1a051bdcfb3db0982
2021-11-08 09:47:33 +08:00
fanquake
12f2b6ac01
Merge bitcoin/bitcoin#23453: Remove the build_msvc/testconsensus project
bb1c84082c Remove the build_msvc/testconsensus project (Aaron Clauson)

Pull request description:

  The testconsensus project is not integral to the Bitcoin Core code. It was originally added as a quick and dirty demo of how to do a consensus check with the msvc build. There are better examples.

  PR #23438 made a change that caused a compiler error with the buildmsvc/testconsensus code. Rather than leave it hanging around to incur potential bitrot, or further PR build failures, it should be removed.

ACKs for top commit:
  hebasto:
    ACK bb1c84082c, tested on Windows 10 Pro (20H2).

Tree-SHA512: d81b99eb09171b66c179961b15f0b2e2e97e5ee7f011f18667e890c90e3d169593ad9aedd05a8616e962212952048827b7159d3c2a2ecb7ac378136b80bf6b23
2021-11-08 09:43:48 +08:00
Hennadii Stepanov
095f07744c
ci: Do not print git log for empty COMMIT_RANGE 2021-11-07 17:04:06 +02:00
Aaron Clauson
bb1c84082c
Remove the build_msvc/testconsensus project
The testconsensus project is not integral to the Bitcoin Core code. It was originally added as a quick and dirty demo of how to do a consensus check with the msvc build. There are better examples.

PR #23438 made a change that caused a compiler error with the buildmsvc/testconsensus code. Rather than leave it hanging around to incur potential bitrot, or furhter PR build failures, it should be removed.
2021-11-06 21:32:34 +00:00
fanquake
e7c0d506d5
doc: update SECURITY.md inline with recent changes to bitcoincore.org
See https://github.com/bitcoin-core/bitcoincore.org/pull/809 and
https://github.com/bitcoin-core/bitcoincore.org/pull/819 and
https://bitcoincore.org/en/contact/.
2021-11-06 18:05:07 +08:00
W. J. van der Laan
7eb5b25e6e doc: Mention that BerkeleyDB is for legacy wallet in build-unix
This updates build-unix for the descriptor wallet, and prepares for
eventual legacy wallet deprecation.

- Move 'descriptor wallet' dependencies above legacy wallet deps both
for Debian and Fedora.
- Explicitly mention 'legacy wallet' where referring to the BerkeleyDB
wallet. Shorten BerkeleyDB instruction to a single paragraph.
2021-11-05 19:27:17 +01:00
MarcoFalke
77a2f5d30c
Merge bitcoin/bitcoin#23334: fuzz: Descriptor wallet
11115169a1 ci: Build fuzz with libsqlite3-dev (MarcoFalke)
fa7c6efca6 fuzz: Add wallet fuzz test (MarcoFalke)
fa59d2ce5b refactor: Use local args instead of global gArgs in CWallet::Create (MarcoFalke)
fadb44606f build: Inline FUZZ_SUITE_LDFLAGS_COMMON (MarcoFalke)

Pull request description:

  Initial sketch to fuzz descriptor wallets. Can be improved in the future.

ACKs for top commit:
  mjdietzx:
    Code review ACK 1111516

Tree-SHA512: b1d2f24504d1ed5f3c6a031210f04c27c13d4e15576c4acbf50ded37ac45f7b7a5c7553e91d81d4a06e9ea73b3d745a552218d3ef3b2932fa5325a8331b0d3fd
2021-11-05 10:29:21 +01:00
glozow
14cd7bf793 [test] call CheckPackage for package sanitization checks
Makes the test more minimal. We're just trying to test that our package
sanitization logic is correct. Now that this code lives in its own
function (rather than inside of AcceptMultipleTransactions), there's no
need to call ProcessNewPackage to test this.
2021-11-04 14:55:12 -04:00
glozow
6876378365 MOVEONLY: move package unit tests to their own file 2021-11-04 14:55:12 -04:00
glozow
c9b1439ca9 MOVEONLY: mempool checks to their own functions
No change in behavior, because package transactions would not be going
through the rbf logic in PreChecks anyway (BIP125 is currently disabled
for package acceptance, see ATMPArgs).

We draw the line here because each individual transaction in package
validation still goes through all PreChecks. For example, checking that
one's own conflicts and dependencies are disjoint (a consensus check)
and individual transaction mempool ancestor/descendant limits.
2021-11-04 14:55:12 -04:00
glozow
9e910d8152 scripted-diff: clean up MemPoolAccept aliases
The aliases are leftover from a previous MOVEONLY refactor - they are
unnecessary and removing them reduces the diff for splitting out mempool
Checks from PreChecks, making RBF variables MemPoolAccept-wide, etc.

-BEGIN VERIFY SCRIPT-

unalias() { sed -i "s:\<$1\>:$2:g" src/validation.cpp; sed -i "/$2 = $2/d" src/validation.cpp; }

unalias nModifiedFees 		  ws.m_modified_fees
unalias nConflictingFees      	  ws.m_conflicting_fees
unalias nConflictingSize          ws.m_conflicting_size
unalias setConflicts 	          ws.m_conflicts
unalias allConflicting		  ws.m_all_conflicting
unalias setAncestors	          ws.m_ancestors

-END VERIFY SCRIPT-
2021-11-04 14:54:03 -04:00
Martin Leitner-Ankerl
a04350b86c
Open streams_test_tmp file in temporary folder
The tests `streams_tests/streams_buffered_file` and `streams_tests/streams_buffered_file_rand`
did not use a the temporary directory provided by  `BasicTestingSetup`, so it was not possible
to execute multiple of them in parallel. This fixes that.

To reproduce, run

```sh
parallel --halt now,fail=1 './src/test/test_bitcoin --run_test=streams_tests/streams_buffered_file_rand' -- ::: {1..1000}
```

This executes the test 1000 times, one job per CPU. It works on that commit but mergebase fails quickly.
2021-11-04 18:47:14 +01:00
glozow
fd92b0c398 document workspace members 2021-11-04 12:38:13 -04:00
glozow
3d3e4598b6 [validation] cache iterators to mempool conflicts 2021-11-04 12:38:11 -04:00
Samuel Dobson
24abd8312e
Merge bitcoin/bitcoin#22949: fee: Round up fee calculation to avoid a lower than expected feerate
80dc829be7 tests: Calculate fees more similarly to CFeeRate::GetFee (Andrew Chow)
ce2cc44afd tests: Test for assertion when feerate is rounded down (Andrew Chow)
0fbaef9676 fees: Always round up fee calculated from a feerate (Andrew Chow)

Pull request description:

  When calculating the fee for a feerate, it is possible that the final calculation will have fractional satoshis. Currently those are ignored via truncation which results in the absolute fee being rounded down. Rounding down is problematic because it results in a feerate that is slightly lower than the feerate represented by the `CFeeRate` object. A slightly lower feerate particularly causes issues for coin selection as it can trigger an assertion error. To avoid potentially underpaying the feerate (and the assertion), always round up the calculated fee.

  A test is added for the assertion, along with a comment explaining what happens.

  It is unlikely that a user can trigger this as it requires a very specific set of rounding errors to occur as well as the transaction not needing any change and being right on the lower bound of the exact match window. However I was able to trigger the assertion while running coin selection simulations, albeit after thousands of transactions and with some weird feerates.

ACKs for top commit:
  ryanofsky:
    Code review ACK 80dc829be7
  promag:
    Tested ACK 80dc829be7.
  lsilva01:
    tACK 80dc829
  meshcollider:
    utACK 80dc829be7

Tree-SHA512: fe26684c60f236cab48ea6a4600c141ce766dbe59504ec77595dcbd7fd0b34559acc617007f4f499c9155d8fda0a336954413410ba862b19c765c0cfac79d642
2021-11-05 00:08:00 +13:00
John Newbery
0fdb619aaf [validation] Always call mempool.check() after processing a new transaction
CTxMemPool::check() will carry out internal consistency checks 1/n times,
where n is set by the `-checkmempool` configuration option. By default,
mempool consistency checks are disabled entirely on mainnet.

Therefore, this change has no effect on mainnet nodes running with
default configuration. It simply removes the responsibility to trigger
mempool consistency checks from net_processing.
2021-11-03 14:37:45 +00:00
John Newbery
2c64270bbe [refactor] Don't call AcceptToMemoryPool() from outside validation.cpp 2021-11-03 14:34:41 +00:00
John Newbery
92a3aeecf6 [validation] Add CChainState::ProcessTransaction()
This just calls through to AcceptToMemoryPool() internally, and is currently unused.

Also add a new transaction validation failure reason TX_NO_MEMPOOL to
indicate that there is no mempool.
2021-11-03 14:34:38 +00:00
John Newbery
36167faea9 [logging/documentation] Remove reference to AcceptToMemoryPool from error string
User-facing error messages should not leak internal implementation
details like function names. Update the MEMPOOL_REJECTED error string
from "Transaction rejected by AcceptToMemoryPool" to the more generic
"Transaction rejected by mempool". Also update the MEMPOOL_ERROR error
message from "AcceptToMemoryPool failed" to the more precise "Mempool
internal error" since this error indicates and internal (e.g.
logic/hardware/etc) failure, and not a transaction rejection.
2021-11-03 14:28:04 +00:00
John Newbery
4c24142b1e [validation] Remove comment about AcceptToMemoryPool()
"This logic is not necessary for memory pool transactions, as
AcceptToMemoryPool already refuses previously-known transaction ids
entirely." refers to the logic at
a206b0ea12/src/main.cpp (L484-L486),
which was later removed in commit 450cbb0944.
2021-11-03 14:28:04 +00:00
Vasil Dimov
420695c193
contrib: recognize CJDNS seeds as such
An IPv6 address from fc00::/8 could be either from the CJDNS network or
from a private-unroutable-reserved segment of IPv6. A seed node with
such an address must be from the CJDNS network, otherwise other peers
will not be able to connect to it.
2021-11-03 14:58:55 +01:00
Vasil Dimov
f9c28330a0
net: take the first 4 random bits from CJDNS addresses in GetGroup()
CJDNS addresses start with constant 8 bits, so in order to account for
the first 4 random ones, we must take the first 12. Otherwise the entire
CJDNS network will belong to one group.
2021-11-03 14:58:54 +01:00
Vasil Dimov
29ff79c0a2
net: relay CJDNS addresses even if we are not connected to CJDNS
This will help with propagation, so that multi-homed nodes can learn
CJDNS addresses outside of the CJDNS network.
2021-11-03 14:58:53 +01:00
Vasil Dimov
d96f8d304c
net: don't skip CJDNS from GetNetworkNames() 2021-11-03 14:58:53 +01:00
Vasil Dimov
c2d751abba
net: take CJDNS into account in CNetAddr::GetReachabilityFrom()
This way `GetLocal()` will pick our CJDNS address for a CJDNS peer.
2021-11-03 14:58:52 +01:00
Vasil Dimov
9b43b3b257
test: extend feature_proxy.py to test CJDNS 2021-11-03 14:58:51 +01:00
Vasil Dimov
508eb258fd
test: remove default argument of feature_proxy.py:node_test()
The default bool argument makes it harder to read because the last but
one argument is also bool. Pass all of them as named arguments to
increase readability.

Another bool argument will be added to indicate whether to test CJDNS.

Co-authored-by: Jon Atack <jon@atack.com>
2021-11-03 14:58:50 +01:00
Vasil Dimov
6387f397b3
net: recognize CJDNS addresses as such
In some cases addresses come from an external source as a string or as a
`struct sockaddr_in6`, without a tag to tell whether it is a private
IPv6 or a CJDNS address. In those cases interpret the address as a CJDNS
address instead of an IPv6 address if `-cjdnsreachable` is set and the
seemingly-IPv6-address belongs to `fc00::/8`. Those external sources are:

* `-externalip=`
* `-bind=`
* UPnP
* `getifaddrs(3)` (called through `-discover`)
* `addnode`
* `connect`
* incoming connections (returned by `accept(2)`)
2021-11-03 14:58:50 +01:00
Vasil Dimov
e6890fcb44
net: don't skip CJDNS from GetNetworksInfo() 2021-11-03 14:58:49 +01:00
Vasil Dimov
e9d90d3c11
net: introduce a new config option to enable CJDNS
CJDNS is set up in the host OS, outside of the application. When the
routing is configured properly then connecting to fc00::/8 results in
connecting to the CJDNS network.

Introduce an option so that Bitcoin Core knows whether this is the case.
2021-11-03 14:58:48 +01:00
Vasil Dimov
78f456c576
net: recognize CJDNS from ParseNetwork()
This allows to use "cjdns" as an argument to the `getnodeaddresses` RPC
and to the `-onlynet=` parameter.
2021-11-03 14:41:14 +01:00
Vasil Dimov
de01e312b3
net: use -proxy for connecting to the CJDNS network
If `-proxy` is given, then also use it for connecting to the CJDNS
network.
2021-11-03 14:41:14 +01:00
Vasil Dimov
aedd02ef27
net: make it possible to connect to CJDNS addresses
Connecting to CJDNS addresses works without a proxy, just like
connecting to an IPv6 address. Thus adapt `CService::GetSockAddr()` to
retrieve the `struct sockaddr*` even for `CService::IsCJDNS()` objects.
2021-11-03 14:41:09 +01:00
John Newbery
5759fd12b8 [test] Don't set bypass_limits to true in txvalidation_tests.cpp
AcceptToMemoryPool() is called for an invalid coinbase transaction, so
setting bypass_limits to true or false has no impact on the test.

The only way that changing bypass_limits from true to false could change
the result would be to change the outcome to INVALID(TX_MEMPOOL_POLICY).
Since the ATMP call in this test results in INVALID(TX_CONSENSUS) both
before and after this change, there is no change in behavior.
2021-11-03 12:04:49 +00:00
John Newbery
497c9e2964 [test] Don't set bypass_limits to true in txvalidationcache_tests.cpp
AcceptToMemoryPool() is called for transactions with fees above
minRelayTxFee and with the mempool not full, so setting bypass_limits to
true or false has no impact on the test.

The only way that changing bypass_limits from true to false could change
the result would be to change the outcome to INVALID(TX_MEMPOOL_POLICY).
Since all the ATMP calls in this test result in VALID both before and
after this change, there is no change in behavior.
2021-11-03 12:04:46 +00:00
MarcoFalke
23ae7931be
Merge bitcoin/bitcoin#23154: doc: add assumeutxo notes
9ab440199d doc: add assumeutxo notes (James O'Beirne)

Pull request description:

  This is part of the [assumeutxo project](https://github.com/bitcoin/bitcoin/projects/11) (parent PR: #15606)

  ---

  Adds some notes on assumeutxo design.

  Related: https://github.com/bitcoin/bitcoin/pull/21526#discussion_r715558994

ACKs for top commit:
  ariard:
    ACK 9ab4401
  naumenkogs:
    ACK 9ab4401
  michaelfolkson:
    ACK 9ab440199d
  fjahr:
    ACK 9ab440199d

Tree-SHA512: 2fca8373b78701754957d12bc43ce18aa6928507965448741cb4e8c56589ad61d261f8542e348094fc9631d46ee6a7afee75c965c0db993fc816758569137b74
2021-11-03 13:01:53 +01:00
Hennadii Stepanov
459e208276
Exit early for an empty vChecks in CCheckQueue::Add 2021-11-03 11:26:57 +02:00
Hennadii Stepanov
c43aa62343
Avoid excessive lock contention in CCheckQueue::Add 2021-11-03 11:26:49 +02:00
Hennadii Stepanov
ee03c782ba
wallet: Make GetOldestKeyPoolTime return nullopt for blank wallets
This change suppress the "keypoololdest" field in the getwalletinfo RPC
response for blank descriptor wallets.
2021-11-03 10:35:47 +02:00
Hennadii Stepanov
3e4f069d23
wallet, refactor: Make GetOldestKeyPoolTime return type std::optional
This change gets rid of the magic number 0 in the
DescriptorScriptPubKeyMan::GetOldestKeyPoolTime() function.

No behavior change.
2021-11-03 10:35:47 +02:00