Commit Graph

17290 Commits

Author SHA1 Message Date
fanquake
6ebb9d0e46 Merge bitcoin/bitcoin#22808: [0.21] 0.21.2rc2 backports
d9b18c1290 Fix build with Boost 1.77.0 (Rafael Sadowski)
2d7f2606c1 ci: Run fuzzer task for the master branch only (Hennadii Stepanov)

Pull request description:

  Backported:

  1) #22730
  1) #22713

ACKs for top commit:
  fanquake:
    ACK d9b18c1290 - Checked the backports and tested building this branch with system Boost 1.76.0 and depends Boost 1.77.0.

Tree-SHA512: dc3e0a2b3c1e3e80f6570e329a08ebc5103c233c30562f660432891c90bacb4d88d5373e32b9ac34fd143be46b8e63900ce9f52786b04bc799a4d17ba9fd8499
2021-08-28 15:33:34 +08:00
Rafael Sadowski
d9b18c1290 Fix build with Boost 1.77.0
BOOST_FILESYSTEM_C_STR changed to accept the path as an argument

Github-Pull: bitcoin/bitcoin#22713
Rebased-From: acb7aad27e
2021-08-27 09:54:05 +03:00
Hennadii Stepanov
2a7568999c qt: Pre-0.21.2rc2 translations update 2021-08-27 00:29:27 +03:00
W. J. van der Laan
89d148c8c6 qt: Translations update for 0.21.2rc1
Tree-SHA512: f0a74deb84711645ba112b364fbe958db51992f28d0ec87262dd0a21f1052a270f5fc8c13dfd6dc6f5a8a5580e7f1991b3de2d44e3a44252cd3c315dfc2e00ba
2021-08-11 13:23:05 +02:00
Pieter Wuille
2a57108051 Avoid Appveyor compilation failure 2021-08-05 09:48:25 -07:00
Pieter Wuille
a653aacbd6 Add logging and addr rate limiting statistics
Includes logging improvements by Vasil Dimov and John Newbery.

Github-Pull: #22387
Rebased-From: f424d601e1
2021-08-05 09:40:04 -07:00
Pieter Wuille
8df3e5bd84 Randomize the order of addr processing
Github-Pull: #22387
Rebased-From: 5648138f59
2021-08-05 09:40:04 -07:00
Pieter Wuille
83dfe6c65e Rate limit the processing of incoming addr messages
While limitations on the influence of attackers on addrman already
exist (affected buckets are restricted to a subset based on incoming
IP / network group), there is no reason to permit them to let them
feed us addresses at more than a multiple of the normal network
rate.

This commit introduces a "token bucket" rate limiter for the
processing of addresses in incoming ADDR and ADDRV2 messages.
Every connection gets an associated token bucket. Processing an
address in an ADDR or ADDRV2 message from non-whitelisted peers
consumes a token from the bucket. If the bucket is empty, the
address is ignored (it is not forwarded or processed). The token
counter increases at a rate of 0.1 tokens per second, and will
accrue up to a maximum of 1000 tokens (the maximum we accept in a
single ADDR or ADDRV2). When a GETADDR is sent to a peer, it
immediately gets 1000 additional tokens, as we actively desire many
addresses from such peers (this may temporarily cause the token
count to exceed 1000).

The rate limit of 0.1 addr/s was chosen based on observation of
honest nodes on the network. Activity in general from most nodes
is either 0, or up to a maximum around 0.025 addr/s for recent
Bitcoin Core nodes. A few (self-identified, through subver) crawler
nodes occasionally exceed 0.1 addr/s.

Github-Pull: #22387
Rebased-From: 0d64b8f709
2021-08-05 09:40:00 -07:00
Pavol Rusnak
080b47d9ce rpc: reset scantxoutset progress on finish
Github-Pull: #19362
Rebased-From: 8c4129b454
2021-07-29 16:02:26 +08:00
Hennadii Stepanov
e3f1da4bf3 qt: Draw "eye" sign at the beginning of watch-only addresses
Github-Pull: bitcoin-core/gui#365
Rebased-From: cd46c11577
2021-07-11 12:03:33 +03:00
Hennadii Stepanov
6ca54ce2ae qt: Do not extend recent transaction width to address/label string
Github-Pull: bitcoin-core/gui#365
Rebased-From: 9ea1da6fc9
2021-07-11 12:03:12 +03:00
Hennadii Stepanov
f220368220 qt: Do not use QClipboard::Selection on Windows and macOS.
Windows and macOS do not support the global mouse selection.

Github-Pull: bitcoin-core/gui#277
Rebased-From: 7f3a5980c1
2021-07-11 12:03:11 +03:00
fanquake
bd2f4164c6 Merge bitcoin/bitcoin#22366: [0.21] fuzz: add missing ECCVerifyHandle to base_encode_decode
da816247f0 util: Properly handle -noincludeconf on command line (MarcoFalke)
513613d8a8 Cleanup -includeconf error message (MarcoFalke)
70eac6fcd0 Fix crash when parsing command line with -noincludeconf=0 (MarcoFalke)
c5357fa415 fuzz: add missing ECCVerifyHandle to base_encode_decode (Andrew Poelstra)

Pull request description:

  Backports #22279, #22002 and #22137 to fix fuzzing issues in the 0.21 branch: https://github.com/bitcoin/bitcoin/runs/2864012729.

ACKs for top commit:
  achow101:
    ACK da816247f0

Tree-SHA512: ab8751387e42e03ff43594ae34be8ed0dba903d7da1aaecb9f19c08366570d8995abe89ba0c9bafe37662940f3e83bef1e9e50f330e86114cd6a773becd1fd21
2021-07-08 11:52:07 +08:00
MarcoFalke
4c29b63cfb Merge bitcoin/bitcoin#22255: [0.21] wallet: Do not iterate a directory if having an error while accessing it
7b0b201d10 wallet: Do not iterate a directory if having an error while accessing it (Hennadii Stepanov)

Pull request description:

  This change prevents infinite looping for, for example, system folders
  on Windows.

  Github-Pull: #21907
  Rebased-From: 29c9e2c2d2

  Note: Trivial backport, but in a differently-named function in another file

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

Tree-SHA512: d41ab267250e8bfd9289cacf1fd804cc1a3bb20fc479dc9da5a69ebf26530b552b11b2ee6b11e17a1c146ca792ee65bd64eeb2269fa5e73a70361da8a2a09925
2021-07-01 08:35:53 +02:00
MarcoFalke
da816247f0 util: Properly handle -noincludeconf on command line
This bug was introduced in commit
fad0867d6a.

Unit test
Co-Authored-By: Russell Yanofsky <russ@yanofsky.org>

Github-Pull: #22137
Rebased-From: fa910b4765
2021-06-30 10:39:33 +08:00
MarcoFalke
513613d8a8 Cleanup -includeconf error message
Remove the erroneous trailing newline '\n'. Also, print only the first
value to remove needless redundancy in the error message.

Github-Pull: #22002
Rebased-From: fad0867d6a
2021-06-30 10:23:54 +08:00
MarcoFalke
70eac6fcd0 Fix crash when parsing command line with -noincludeconf=0
Github-Pull: #22002
Rebased-From: fa9f711c37
2021-06-30 10:23:51 +08:00
Andrew Poelstra
c5357fa415 fuzz: add missing ECCVerifyHandle to base_encode_decode
GitHub Pull: #22279
Rebased-From: 906d791311
2021-06-29 11:03:27 +08:00
Hennadii Stepanov
7b0b201d10 wallet: Do not iterate a directory if having an error while accessing it
This change prevents infinite looping for, for example, system folders
on Windows.

Github-Pull: #21907
Rebased-From: 29c9e2c2d2
2021-06-15 19:02:45 +00:00
unknown
46320ba72f Remove user input from URI error message
+ Detailed error messages for invalid address
+ Used `IsValidDestination` instead of `IsValidDestinationString`
+ Referred to https://github.com/bitcoin/bitcoin/pull/20832 for solution

Github-Pull: bitcoin-core/gui#280
Rebased-From: 3bad0b3fad
2021-05-22 10:45:20 +02:00
Jon Atack
f2a88986a1 p2p, bugfix: use NetPermissions::HasFlag() in CConnman::Bind()
PF_NOBAN is a multi-flag that includes PF_DOWNLOAD, so the conditional
in CConnman::Bind() using a bitwise AND will return the same result
for both the "noban" status and the "download" status.

Example:

`PF_DOWNLOAD` is `0b1000000`
`PF_NOBAN`    is `0b1010000`

This makes a check like `flags & PF_NOBAN` return `true` even if `flags`
is equal to `PF_DOWNLOAD`.

If `-whitebind=download@1.1.1.1:8765` is specified, then `1.1.1.1:8765`
should be added to the list of local addresses. We only want to avoid
adding to local addresses (that are advertised) a whitebind that has a
`noban@` flag.

As a result of a mis-check in `CConnman::Bind()` we would not have added
`1.1.1.1:8765` to the local addresses in the example above.

Co-authored-by: Vasil Dimov <vd@FreeBSD.org>

Github-Pull: bitcoin/bitcoin#21644
Rebased-From: dde69f20a0
2021-05-22 09:58:26 +02:00
W. J. van der Laan
ab20518191 gui: Pre-rc1 translations update
Tree-SHA512: 6978293bda56b0cb1370f3ddf201477a2f12e0b8c9462d3f4703b837d9be4be65142a5e97c4a473fb9fa90edd83dba8a98ea3b0ecc335062868d1e6c550241b2
2021-04-16 13:21:07 +02:00
Anthony Towns
b8af67eeef fuzz: cleanups for versionbits fuzzer
Github-Pull: #21489
Rebased-From: aa7f418fe3
2021-04-16 11:21:02 +02:00
Vasil Dimov
79cdb4a198 test: make sure non-IP peers get discouraged and disconnected
Github-Pull: #21571
Rebased-From: 81747b2171
2021-04-16 11:20:04 +02:00
Vasil Dimov
b765f41164 test: also check disconnect in denialofservice_tests/peer_discouragement
Use `CConnmanTest` instead of `CConnman` and add the nodes to it
so that their `fDisconnect` flag is set during disconnection.

Github-Pull: #21571
Rebased-From: 637bb6da36
2021-04-16 11:20:04 +02:00
Vasil Dimov
dfeb6c10bb test: use pointers in denialofservice_tests/peer_discouragement
This is a non-functional change that replaces the `CNode` on-stack
variables with `CNode` pointers.

The reason for this is that it would allow us to add those `CNode`s
to `CConnman::vNodes[]` which in turn would allow us to check that they
are disconnected properly - a `CNode` object must be in
`CConnman::vNodes[]` in order for its `fDisconnect` flag to be set.

If we store pointers to the on-stack variables in `CConnman` then it
would crash at the end, trying to `delete` them.

Github-Pull: #21571
Rebased-From: 4d6e246fa4
2021-04-16 11:20:04 +02:00
MarcoFalke
e3b76b6c13 Merge #21701: [0.21] Speedy trial activation for Taproot
cbd64c3a28 Add mainnet and testnet taproot activation params (Andrew Chow)
ec7824396b chainparams: drop versionbits threshold to 90% for mainnnet and signet (Anthony Towns)
600357306e versionbits: simplify state transitions (Anthony Towns)
3acf0379e0 versionbits: Add explicit NEVER_ACTIVE deployments (Anthony Towns)
b529222ad1 fuzz: test versionbits delayed activation (Anthony Towns)
71917e01eb tests: test versionbits delayed activation (Anthony Towns)
4cab84cfdf versionbits: Add support for delayed activation (Anthony Towns)
f9517e6014 tests: clean up versionbits test (Anthony Towns)
1c0164544c tests: test ComputeBlockVersion for all deployments (Anthony Towns)
2e9e7f4329 tests: pull ComputeBlockVersion test into its own function (Anthony Towns)

Pull request description:

  Backport of #21377 and #21686

ACKs for top commit:
  instagibbs:
    cherry-pick ACK cbd64c3a28
  jnewbery:
    ACK cbd64c3a28
  Sjors:
    tACK cbd64c3
  MarcoFalke:
    cherry-pick-only ACK cbd64c3a28 🌾

Tree-SHA512: e9efb0ca9986d685161bcba5ed43efdc5f1dca88322cf65faccf17009b567c2d930c2aba4d1541539fc65347574ed4faa3d4558b907c779d1c128b3d2c681f31
2021-04-16 11:12:35 +02:00
fanquake
0fe5b6130c Merge #21520: [0.21] wallet: Avoid requesting fee rates multiple times during coin selection
d61fb07da7 Rename CoinSelectionParams::effective_fee to m_effective_feerate (Andrew Chow)
5fc381e443 wallet: Move discard feerate fetching to CreateTransaction (Andrew Chow)
bcd716670b wallet: Move long term feerate setting to CreateTransaction (Andrew Chow)
34c89f92f3 wallet: Replace nFeeRateNeeded with effective_fee (Andrew Chow)
48fc675163 wallet: Use existing feerate instead of getting a new one (Andrew Chow)

Pull request description:

  Backport of #21083

ACKs for top commit:
  MarcoFalke:
    cherry-pick-only re-ACK d61fb07da7 🔙
  instagibbs:
    utACK d61fb07da7

Tree-SHA512: 23b212301bb467153dd9723903918ae01dd520525c81d541c411e7a4381e46594fe032e2a7c06ddcff7dc56dcb546991d50187c33fcff08ec45bd835cc01bd19
2021-04-16 10:10:50 +08:00
Andrew Chow
cbd64c3a28 Add mainnet and testnet taproot activation params
Github-Pull: #21686
Rebased-From: f979b3237f
2021-04-15 20:59:21 -04:00
Anthony Towns
ec7824396b chainparams: drop versionbits threshold to 90% for mainnnet and signet
Github-Pull: #21377
Rebased-From: ffe33dfbd4
2021-04-15 20:59:19 -04:00
Anthony Towns
600357306e versionbits: simplify state transitions
This removes the DEFINED->FAILED transition and changes the
STARTED->FAILED transition to only occur if signalling didn't pass the
threshold. This ensures that it is always possible for activation to
occur, no matter what settings are chosen, or the speed at which blocks
are found.

Github-Pull: #21377
Rebased-From: f054f6bcd2
2021-04-15 20:59:17 -04:00
Anthony Towns
3acf0379e0 versionbits: Add explicit NEVER_ACTIVE deployments
Previously we used deployments that would timeout prior to Bitcoin's
invention, which allowed the deployment to still be activated in unit
tests. This switches those deployments to be truly never active.

Github-Pull: #21377
Rebased-From: 55ac5f568a
2021-04-15 20:59:13 -04:00
Anthony Towns
b529222ad1 fuzz: test versionbits delayed activation
Github-Pull: #21377
Rebased-From: dd07e6da48
2021-04-15 20:58:49 -04:00
Anthony Towns
71917e01eb tests: test versionbits delayed activation
Github-Pull: #21377
Rebased-From: dd85d5411c
2021-04-15 20:58:42 -04:00
Anthony Towns
4cab84cfdf versionbits: Add support for delayed activation
Github-Pull: #21377
Rebased-From: 73d4a70639
2021-04-15 12:03:27 -04:00
Anthony Towns
f9517e6014 tests: clean up versionbits test
Simplify the versionbits unit test slightly to make the next set of
changes a little easier to follow.

Github-Pull: #21377
Rebased-From: 9e6b65f6fa
2021-04-15 12:03:25 -04:00
Anthony Towns
1c0164544c tests: test ComputeBlockVersion for all deployments
This generalises the ComputeBlockVersion test so that it can apply to
any activation parameters we might set, and checks all the parameters
set for each deployment on each chain, to simultaneously ensure that the
deployments we have configured work sensibly, and that the test code
does not suffer bitrot in the event that all interesting deployments
are buried.

Github-Pull: #21377
Rebased-From: 5932744450
2021-04-15 12:03:24 -04:00
Anthony Towns
2e9e7f4329 tests: pull ComputeBlockVersion test into its own function
The intent here is to allow checking ComputeBlockVersion behaviour with
each deployment, rather than only testdummy on mainnet. This commit does
the trivial refactoring component of that change.

Github-Pull: #21377
Rebased-From: 63879f0a47
2021-04-15 12:03:22 -04:00
Andrew Chow
7de019bc61 Introduce DeferringSignatureChecker and inherit with SignatureExtractor
Introduces a DeferringSignatureChecker which simply takes a
BaseSignatureChecker and passes through everything.
SignatureExtractorChecker now subclasses DeferringSignatureChecker. This
allows for all BaseSignatureChecker functions to be implemented for
SignatureExtractorChecker, while allowing for future signature checkers
which opreate similarly to SignatureExtractorChecker.

Github-Pull: #21166
Rebased-From: 6965456c10
2021-04-08 18:18:55 -04:00
fanquake
1a9a2cb7dc net: add ifaddrs.h include
Github-Pull: #21486
Rebased-From: 4783115fd4
2021-04-06 17:36:11 +08:00
fanquake
e99d6d0c7c rand: only try and use freeifaddrs if available
Github-Pull: #21486
Rebased-From: 87deac66aa
2021-04-06 17:34:57 +08:00
Andrew Chow
d61fb07da7 Rename CoinSelectionParams::effective_fee to m_effective_feerate
It's a feerate, not a fee. Also follow the style guide for member names.

Github-Pull: #21083
Rebased-From: f9cd2bfbcc
2021-04-01 12:44:00 -04:00
Fabian Jahr
1e9671116f naming nits
Github-Pull: #20861
Rebased-From: 03346022d6
2021-03-27 12:09:48 -07:00
Pieter Wuille
7dfe406e20 Add signet support to gen_key_io_test_vectors.py
Github-Pull: #20861
Rebased-From: 2e7c80fb5b
2021-03-27 12:09:48 -07:00
Pieter Wuille
593e206627 Use Bech32m encoding for v1+ segwit addresses
This also includes updates to the Python test framework implementation,
test vectors, and release notes.

Github-Pull: #20861
Rebased-From: fe5e495c31
2021-03-27 12:09:44 -07:00
Pieter Wuille
8944aaa6d6 Add Bech32m test vectors
Github-Pull: #20861
Rebased-From: 25b1c6e13d
2021-03-27 12:09:13 -07:00
Pieter Wuille
1485533092 Implement Bech32m encoding/decoding
Github-Pull: #20861
Rebased-From: da2bb6976d
2021-03-27 12:09:13 -07:00
Andrew Chow
5fc381e443 wallet: Move discard feerate fetching to CreateTransaction
Instead of fetching the discard feerate for each SelectCoinsMinConf
iteration, fetch and cache it once during CreateTransaction so that it
is shared for each SelectCoinsMinConf through
coin_selection_params.m_discard_feerate.

Does not change behavior.

Github-Pull: #21083
Rebased-From: bdd0c2934b
2021-03-24 00:34:54 -04:00
Andrew Chow
bcd716670b wallet: Move long term feerate setting to CreateTransaction
Instead of setting the long term feerate for each SelectCoinsMinConf
iteration, set it once during CreateTransaction and let it be shared
with each SelectCoinsMinConf through
coin_selection_params.m_long_term_feerate.

Does not change behavior.

Github-Pull: #21083
Rebased-From: 448d04b931
2021-03-24 00:23:02 -04:00
Andrew Chow
34c89f92f3 wallet: Replace nFeeRateNeeded with effective_fee
Make sure that all fee calculations use the same feerate.
coin_selection_params.effective_fee is the variable we use for all fee
calculations, so get rid of remaining nFeeRateNeeded usages and just
directly set coin_selection_params.effective_fee.

Does not change behavior.

Github-Pull: #21083
Rebased-From: e2f429e6bb
2021-03-24 00:19:34 -04:00