Commit graph

26213 commits

Author SHA1 Message Date
fanquake
e21b824386
Merge #20109: Release notes and followups from 19339
88197b0769 [doc] release notes for max fee checking (gzhao408)
c201d73df3 style and nits for fee-checking in BroadcastTransaction (gzhao408)

Pull request description:

  Pretty trivial... addresses some tiny comments from #19339. Also fixes a docs typo from #19940 and adds a release note about the error message change for testmempoolaccept.

ACKs for top commit:
  achow101:
    ACK 88197b0769
  MarcoFalke:
    cr re-ACK 88197b0769

Tree-SHA512: fff16d731426b9b4db5222df02633983402f4c7241551eec98bb1554145dbdc132f40ed8ca4abd5edcebe1f4d1e879fb6d11bd91730604f6552c10cdf65706a1
2020-10-14 12:19:42 +08:00
Neha Narula
9c47cb29f9 [Rename only] Rename orphan_work_set to m_orphan_work_set.
This helps distinguish the member from any local variables.
2020-10-13 17:38:38 -04:00
MarcoFalke
fa299ac273
test: Speed up wallet_resendwallettransactions test with mockscheduler RPC 2020-10-13 15:38:18 +02:00
MarcoFalke
3333077823
rpc: Adjust witness-tx deserialize error message 2020-10-13 14:57:52 +02:00
MarcoFalke
ec0453cd57
Merge bitcoin-core/gui#102: Fix SplashScreen crash when run with -disablewallet
c056064a4a gui: Fix SplashScreen crash when run with -disablewallet (Hennadii Stepanov)

Pull request description:

  This PR fixes the bug introduced in https://github.com/bitcoin/bitcoin/pull/19099:

  ```
  $ src/qt/bitcoin-qt -disablewallet
  bitcoin-qt: interfaces/node.cpp:236: auto interfaces::(anonymous namespace)::NodeImpl::walletClient()::(anonymous class)::operator()() const: Assertion `"m_context->wallet_client" && check' failed.
  Aborted (core dumped)
  ```

ACKs for top commit:
  Sjors:
    tACK c056064
  promag:
    ACK c056064a4a.

Tree-SHA512: 263d9efd5899cc6e447dfc5142bf911ca627149fac0a1c5e5b58dd196aa5e0d12fe13e3f750fb5f3c4338222f7959935d2f77391263f967dbca2e0e79a416a29
2020-10-13 14:42:12 +02:00
MarcoFalke
cd6e193d4c
Merge #20126: test: p2p_leak_tx.py improvements (use MiniWallet, add p2p_lock acquires)
5b77f8098d test: add p2p_lock acquires in p2p_leak_tx.py (Sebastian Falbesoner)
cc8c6823b4 test: use MiniWallet for p2p_leak_tx.py (Sebastian Falbesoner)

Pull request description:

  This PR enables one more of the non-wallet functional tests (p2p_leak_tx.py) to be run even with the Bitcoin Core wallet disabled by using the new MiniWallet instead, as proposed in #20078. It also adds missing p2p_lock acquires that need to be held while modifying internal p2p Interface state (in this case the `last_message` dictionary) to avoid data races.

ACKs for top commit:
  laanwj:
    Code review ACK 5b77f8098d

Tree-SHA512: 6661bc6e3491a9af4bf040f379e5955c525136397e99d3eadde92e247580d0d87efff750e6d3b1f6d9a4e578144a433a982f574ef056b44dd6bca33873a1bae6
2020-10-13 14:27:30 +02:00
fanquake
ad90dd9f31
Merge #20141: Avoid the use of abs64 in timedata
d1292f25f2 Avoid the use of abs64 in timedata (Pieter Wuille)

Pull request description:

  Fixes #20135.

ACKs for top commit:
  kallewoof:
    ACK d1292f25f2
  jonatack:
    ACK d1292f25f2 code/logic review, verified there are no remaining callers of `abs64()`, verified no warnings in a debug build
  practicalswift:
    ACK d1292f25f2
  MarcoFalke:
    ACK d1292f25f2 🎹

Tree-SHA512: d17e95c668eb5e02ea546433b3d1b5a0ccbfb2c9cec62fa67dad1844d7e278a2576fbc0b75bddbf4db9af7331e978148c7bef7fce7e6a07e0eb917ef1392f302
2020-10-13 20:00:39 +08:00
Ivan Metlushko
135afa749c wallet: remove db mode string
We never need to open database in read-only mode as it's controlled
separately for every batch.

Also we can safely create database if it doesn't exist already
because require_existing option is verified in MakeDatabase
before creating a new WalletDatabase instance.
2020-10-13 18:42:59 +07:00
Pieter Wuille
d1292f25f2 Avoid the use of abs64 in timedata 2020-10-12 19:50:16 -07:00
Pieter Wuille
0e2a5e448f tests: dumping and minimizing of script assets data
This adds a --dumptests flag to the feature_taproot.py test, to dump all its
generated test cases to files, in a format compatible with the
script_assets_test unit test. A fuzzer for said format is added as well, whose
primary purpose is coverage-based minimization of those dumps.
2020-10-12 17:18:47 -07:00
Pieter Wuille
4567ba034c tests: add generic qa-asset-based script verification unit test
This adds a unit test that does generic script verification tests,
with positive/negative witnesses/scriptsigs, under various flags.
The test data is large (several MB) so it's stored in the qa-assets
repo.
2020-10-12 17:18:47 -07:00
Pieter Wuille
f06e6d0345 tests: functional tests for Schnorr/Taproot/Tapscript
A large functional test is added that automatically generates random transactions which
exercise various aspects of the new rules, and verifies they are accepted into the mempool
(when appropriate), and correctly accepted/rejected in (Python-constructed) blocks.

Includes sighashing code and many tests by Johnson Lau.
Includes a test by Matthew Zipkin.
Includes several tests and improvements by Greg Sanders.
2020-10-12 17:18:47 -07:00
Pieter Wuille
3c226639eb tests: add BIP340 Schnorr signature support to test framework
Add a pure Python implementation of BIP340 signing and verification, tested against
the BIP's test vectors.
2020-10-12 17:18:47 -07:00
Pieter Wuille
206fb180ec --- [TAPROOT] Tests --- 2020-10-12 17:18:47 -07:00
Pieter Wuille
d7ff237f29 Activate Taproot/Tapscript on regtest (BIP 341, BIP 342)
Define a versionbits-based activation for the new consensus rules on regtest.
No activation or activation mechanism is defined for testnet or mainnet.
2020-10-12 17:18:47 -07:00
Pieter Wuille
e9a021d7e6 Make Taproot spends standard + policy limits
This adds a `TxoutType::WITNESS_V1_TAPROOT` for P2TR outputs, and permits spending
them in standardness rules. No corresponding `CTxDestination` is added for it,
as that isn't needed until we want wallet integration. The taproot validation flags
are also enabled for mempool transactions, and standardness rules are added
(stack item size limit, no annexes).
2020-10-12 17:18:47 -07:00
Pieter Wuille
865d2c37e2 --- [TAPROOT] Regtest activation and policy --- 2020-10-12 17:18:47 -07:00
Johnson Lau
72422ce396 Implement Tapscript script validation rules (BIP 342)
This adds a new `SigVersion::TAPSCRIPT`, makes the necessary interpreter
changes to make it implement BIP342, and uses them for leaf version 0xc0
in Taproot script path spends.
2020-10-12 17:18:24 -07:00
Pieter Wuille
330de894a9 Use ScriptExecutionData to pass through annex hash
Instead of recomputing the annex hash every time a signature is verified, compute it
once and cache it in a new ScriptExecutionData structure.
2020-10-12 17:18:15 -07:00
Pieter Wuille
8bbed4b7ac Implement Taproot validation (BIP 341)
This includes key path spending and script path spending, but not the
Tapscript execution implementation (leaf 0xc0 remains unemcumbered in
this commit).

Includes constants for various aspects of the consensus rules suggested
by Jeremy Rubin.
2020-10-12 17:17:56 -07:00
Pieter Wuille
0664f5fe1f Support for Schnorr signatures and integration in SignatureCheckers (BIP 340)
This enables the schnorrsig module in libsecp256k1, adds the relevant types
and functions to src/pubkey, as well as in higher-level `SignatureChecker`
classes. The (verification side of the) BIP340 test vectors is also added.
2020-10-12 17:15:40 -07:00
Johnson Lau
5de246ca81 Implement Taproot signature hashing (BIP 341)
This implements the new sighashing scheme from BIP341, with all relevant
whole-transaction values precomputed once and cached.

Includes changes to PrecomputedTransactionData by Pieter Wuille.
2020-10-12 17:06:38 -07:00
Pieter Wuille
886be97af5 Ignore incorrectly-serialized banlist.dat entries 2020-10-12 15:35:08 -07:00
Pieter Wuille
883cea7dea Restore compatibility with old CSubNet serialization 2020-10-12 15:15:28 -07:00
Pieter Wuille
fd9a0060f0 Report and verify expirations 2020-10-12 12:14:53 -07:00
Pieter Wuille
86f50ed10f Delete limitedmap as it is unused now 2020-10-12 12:14:53 -07:00
Pieter Wuille
cc16fff3e4 Make txid delay penalty also apply to fetches of orphan's parents 2020-10-12 12:14:53 -07:00
Pieter Wuille
173a1d2d3f Expedite removal of tx requests that are no longer needed
Whenever a transaction is added to the mempool or orphan pool, both
its txid and wtxid are considered AlreadyHave, and thus will eventually
be removed from m_txrequest.

The same is true for hashes added to the reject filter, but note that sometimes
only the wtxid is added (in which case only the wtxid can be removed from
m_txrequest).
2020-10-12 12:14:53 -07:00
Pieter Wuille
de11b0a4ef Reduce MAX_PEER_TX_ANNOUNCEMENTS for non-PF_RELAY peers
Maintaining up to 100000 INVs per peer is excessive, as that is far more
than fits in a typical mempool.

Also disable the "overload" penalty for PF_RELAY peers.
2020-10-12 12:14:53 -07:00
Pieter Wuille
242d16477d Change transaction request logic to use txrequest
This removes most transaction request logic from net_processing, and
replaces it with calls to a global TxRequestTracker object.

The major changes are:

* Announcements from outbound (and whitelisted) peers are now always
  preferred over those from inbound peers. This used to be the case for the
  first request (by delaying the first request from inbound peers), and
  a bias afters. The 2s delay for requests from inbound peers still exists,
  but after that, if viable outbound peers remain for any given transaction,
  they will always be tried first.

* No more hard cap of 100 in flight transactions per peer, as there is less
  need for it (memory usage is linear in the number of announcements, but
  independent from the number in flight, and CPU usage isn't affected by it).
  Furthermore, if only one peer announces a transaction, and it has over 100
  in flight and requestable already, we still want to request it from them.
  The cap is replaced with an additional 2s delay (possibly combined with the
  existing 2s delays for inbound connections, and for txid peers when wtxid
  peers are available).

Includes functional tests written by Marco Falke and Antoine Riard.
2020-10-12 12:14:11 -07:00
Pieter Wuille
5b03121d60 Add txrequest fuzz tests
This adds a fuzz test that reimplements a naive reimplementation of
TxRequestTracker (with up to 16 fixed peers and 16 fixed txhashes),
and compares the real implementation against it.
2020-10-12 12:08:47 -07:00
Pieter Wuille
3c7fe0e5a0 Add txrequest unit tests
Add unit tests for TxRequestTracker. Several scenarios are tested,
randomly interleaved with eachother.

Includes a test by Antoine Riard (ariard).
2020-10-12 12:08:43 -07:00
Pieter Wuille
da3b8fde03 Add txrequest module
This adds a new module (unused for now) which defines TxRequestTracker, a data
structure that maintains all information about transaction requests, and coordinates
requests.
2020-10-12 11:01:16 -07:00
Wladimir J. van der Laan
f79a4a8952
Merge #19998: net: Add CNode::ConnectedThroughNetwork member function
3984b78cd7 test: Add tests for CNode::ConnectedThroughNetwork (Hennadii Stepanov)
49fba9c1aa net: Add CNode::ConnectedThroughNetwork member function (Hennadii Stepanov)
d4dde24034 net: Add CNode::m_inbound_onion data member (Hennadii Stepanov)

Pull request description:

  This PR:
  - adds `CNode::ConnectedThroughNetwork` member function
  - is based on #19991, and only last two commits belong to it
  - is required for https://github.com/bitcoin-core/gui/pull/86 and #20002

ACKs for top commit:
  jonatack:
    re-ACK 3984b78cd7 per `git diff 3989fcf 3984b78c`
  laanwj:
    Code review ACK 3984b78cd7

Tree-SHA512: 23a9c8bca8dca75113b5505fe443b294f2d42d03c98c7e34919da12d8396beb8d0ada3a58ae16e3da04b7044395f72cf9c216625afc078256cd6c897ac42bf3d
2020-10-12 18:40:45 +02:00
Vasil Dimov
ba8950ee01
build: optionally skip external warnings
Add an option to `./configure` to suppress compilation warnings from
external headers. The option is off by default (no change in behavior,
show warnings from external headers).

This option is useful if e.g. Boost or Qt is installed outside of
`/usr/include` (warnings from headers in `/usr/include` are already
suppressed by default) and those warnings stand in the way of compiling
Bitcoin Core with `-Werror[=...]` or they just clutter the build output
too much and make our own warnings hard to spot.
2020-10-12 18:18:24 +02:00
MarcoFalke
faad92fe1c
test: Remove unused nVersion=1 in p2p tests
After commit ddefb5c0b7 nVersion is no
longer used in p2p logic when sending messages. Only when receiving
messages, but in this test no messages are received.
2020-10-12 13:11:26 +02:00
Pieter Wuille
9eb590894f Add TaggedHash function (BIP 340)
This adds the TaggedHash function as defined by BIP340 to the hash module, which
is used in BIP340 and BIP341 to produce domain-separated hashes.
2020-10-12 02:06:32 -07:00
Pieter Wuille
450d2b2371 --- [TAPROOT] BIP340/341/342 consensus rules --- 2020-10-12 02:06:32 -07:00
Pieter Wuille
5d62e3a68b refactor: keep spent outputs in PrecomputedTransactionData
A BIP-341 signature message may commit to the scriptPubKeys and amounts
of all spent outputs (including other ones than the input being signed
for spends), so keep them available to signature hashing code.
2020-10-12 02:06:32 -07:00
Vasil Dimov
8e4d62280e
tests: don't export in6addr_loopback
Don't export `in6addr_loopback` because that upsets
`contrib/devtools/symbol-check.py`

Fixes https://github.com/bitcoin/bitcoin/issues/20127
2020-10-12 10:25:08 +02:00
fanquake
af22322dab
Merge #20119: BIP155 follow-ups
56f9dba015 Only relay IPv4, IPv6, Tor addresses (Pieter Wuille)
79f3d9b932 Mention BIP155 in doc/bips.md (Pieter Wuille)

Pull request description:

  This:
  * Documents BIP155 support in doc/bips.md
  * Restricts addrv2 relay to IPv4, IPv6, and Tor addresses. Relaying addresses in ranges that no network software has support for seems like a gratuitous spam vector.

ACKs for top commit:
  jonatack:
    ACK 56f9dba015
  naumenkogs:
    ACK 56f9dba
  hebasto:
    ACK 56f9dba015, verified both links.

Tree-SHA512: f0a2072b3d84a05cdbc7b961c18d7322a2e7260517f5306599ff52d8c728f9167de0a59a6d66cb95d84d69f3028680ce8bd05dab0db8c4f97938a287e5ce9631
2020-10-12 15:47:07 +08:00
Sebastian Falbesoner
5b77f8098d test: add p2p_lock acquires in p2p_leak_tx.py 2020-10-12 00:22:16 +02:00
Sebastian Falbesoner
cc8c6823b4 test: use MiniWallet for p2p_leak_tx.py
This test can now be run even with the Bitcoin Core wallet disabled.
2020-10-11 23:57:56 +02:00
Pieter Wuille
56f9dba015 Only relay IPv4, IPv6, Tor addresses 2020-10-11 11:29:11 -07:00
Pieter Wuille
79f3d9b932 Mention BIP155 in doc/bips.md 2020-10-11 11:29:07 -07:00
fanquake
0b2abaa666
Merge #19954: Complete the BIP155 implementation and upgrade to TORv3
dcf0cb4776 tor: make a TORv3 hidden service instead of TORv2 (Vasil Dimov)
353a3fdaad net: advertise support for ADDRv2 via new message (Vasil Dimov)
201a4596d9 net: CAddress & CAddrMan: (un)serialize as ADDRv2 (Vasil Dimov)
1d3ec2a1fd Support bypassing range check in ReadCompactSize (Pieter Wuille)

Pull request description:

  This PR contains the two remaining commits from #19031 to complete the [BIP155](https://github.com/bitcoin/bips/blob/master/bip-0155.mediawiki) implementation:

  `net: CAddress & CAddrMan: (un)serialize as ADDRv2`
  `net: advertise support for ADDRv2 via new message`

  plus one more commit:

  `tor: make a TORv3 hidden service instead of TORv2`

ACKs for top commit:
  jonatack:
    re-ACK dcf0cb4776 per `git diff 9b56a68 dcf0cb4` only change since last review is an update to the release notes which partially picked up the suggested text. Running a node on this branch and addnode-ing to 6 other Tor v3 nodes, I see "addrv2" and "sendaddrv2" messages in getpeerinfo in both the "bytesrecv_per_msg" and "bytessent_per_msg" JSON objects.
  sipa:
    ACK dcf0cb4776
  hebasto:
    re-ACK dcf0cb4776, the node works flawlessly in all of the modes: Tor-only, clearnet-only, mixed.
  laanwj:
    Edit: I have to retract this ACK for now, I'm having some problems with this PR on a FreeBSD node. It drops all outgoing connections with this dcf0cb4776 merged on master (12a1c3ad1a).
  ariard:
    Code Review ACK dcf0cb4

Tree-SHA512: 28d4d0d817b8664d2f4b18c0e0f31579b2f0f2d23310ed213f1f436a4242afea14dfbf99e07e15889bc5c5c71ad50056797e9307ff8a90e96704f588a6171308
2020-10-11 08:51:57 +08:00
Amiti Uttarwar
41dca087b7 [trivial] Extract connection type doc into file where it is used.
This slightly reduces the size of the binary.
2020-10-09 16:09:51 -07:00
Amiti Uttarwar
3069b56a45 [doc] Improve help for getpeerinfo connection_type field. 2020-10-09 16:08:02 -07:00
Hennadii Stepanov
c056064a4a
gui: Fix SplashScreen crash when run with -disablewallet 2020-10-09 21:14:47 +03:00
gzhao408
88197b0769 [doc] release notes for max fee checking 2020-10-09 08:58:47 -07:00