15411 Commits

Author SHA1 Message Date
Hennadii Stepanov
56baeba2f3
0.20: Update translations after closing 0.20.x on Transifex
See Release schedule for 22.0:
https://github.com/bitcoin/bitcoin/issues/20851
2021-06-02 14:06:27 +03:00
Fabian Jahr
c6709867d3 naming nits
Github-Pull: #20861
Rebased-From: 03346022d611871f2cc185440b19d928b9264d9d
2021-03-27 12:08:33 -07:00
Pieter Wuille
1a4e88e0e8 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: fe5e495c31de47b0ec732b943db11fe345d874af
2021-03-27 12:08:28 -07:00
Pieter Wuille
cf18ac9665 Add Bech32m test vectors
Github-Pull: #20861
Rebased-From: 25b1c6e13ddf1626210d5e3d37298d1f3a78a94f
2021-03-18 14:07:29 -07:00
Pieter Wuille
5f9537b2d9 Implement Bech32m encoding/decoding
Github-Pull: #20861
Rebased-From: da2bb6976dadeec682d163c258c9afecc87d6428
2021-03-18 14:02:48 -07:00
Amiti Uttarwar
19bcf17848 [doc] Add permissions to the getpeerinfo help.
This field was already being returned, but the RPCHelpMan did not indicate
this. So, this PR updates the help text to match.

Github-Pull: #20756
Rebased-From: 667d203687708390bc0f43f2dd3f4ab427b88338
2021-01-05 09:27:23 +01:00
MarcoFalke
d0c75abb28 doc: Extract net permissions doc
Github-Pull: #19192
Rebased-From: fa2c2b50d895ff3402b82ce3db69bfc43053b519
2021-01-05 09:27:23 +01:00
Ben Carman
bcb655d7d1 rpc: Add missing description of vout in getrawtransaction help text
Github-Pull: #20731
Rebased-From: b23349b8804fb60c6b3d7d0e2a95927a0d1b49b9
2021-01-05 09:27:23 +01:00
Wladimir J. van der Laan
98c9d79d2b
gui: Pre-rc1 translations update
Tree-SHA512: 3a262c501cdfe9bda7f33045c6d16fb4d3aa46c11ebfd6664302460413c2333ea39fb201fbd7b9edaddb76f92138a3e026ec2f0a9ba40eabff45ae451d5c6af3
2020-12-10 20:55:24 +01:00
MarcoFalke
953dddbd20
Merge #19740: [0.20] wallet: Simplify and fix CWallet::SignTransaction
6a326cf66f04948ffe729e5540a69e159a7840ad tests: Test that a fully signed tx given to signrawtx is unchanged (Andrew Chow)
2d48d7dcfb93eeec36dd6f5cbad289b89ec69324 Simplify and fix CWallet::SignTransaction (Andrew Chow)

Pull request description:

  Backport `CWallet::SignTransaction` from master which is simpler and not broken.

  Previously `CWallet::SignTransaction` would return false for a fully signed transaction. This is a regression and obviously incorrect - a fully signed transaction is always complete. This occurs because `CWallet::SignTransaction` would iterate through each input and skip any further checks if the input was already signed. It would then end up falling through to the `return false` catch-all thus erroneously saying a fully signed transaction is incomplete. The change to attempting to use all `ScriptPubKeyMan`s fixes this problem since the `LegacyScriptPubKeyMan` (the only spkm implemented in 0.20) will verify inputs during its signing attempt and correctly return that it is complete when the inputs verify. Thus a fully signed transaction will be correctly identified as complete, `LegacyScriptPubKeyMan::SignTranaction` will return true, and so `CWallet::Transaction` will return true too.

  Note that this is not a backport of any specific commit. Rather it is the end result of the changes we have made to this function in master.

  Fixes #19737

ACKs for top commit:
  fjahr:
    Code review ACK 6a326cf66f04948ffe729e5540a69e159a7840ad
  MarcoFalke:
    re-ACK 6a326cf66f 👓

Tree-SHA512: 7b8e04cfc264de01a2de08a99477c1a110fa0965dcbd4305bf4632a165f28b090746789195f5cb584eb6d85e27d4801a09d2dad28e508d7898c7c088e771812b
2020-12-10 20:06:35 +01:00
MarcoFalke
75bf23d861
Merge #20399: Revert "Merge #19606: Backport wtxid relay to v0.20"
fa074d2c7b9c3d34876c428d12672a505d4ce4eb Revert "Merge #19606: Backport wtxid relay to v0.20" (MarcoFalke)

Pull request description:

  The 0.20 branch has bugfixes that should be released. However, a tag can currently not be created because the latest merge introduced a regression and is not a bugfix (https://github.com/bitcoin/bitcoin/pull/20317#issuecomment-723754509, https://github.com/bitcoin/bitcoin/pull/20317#issuecomment-727624755).

  Fix that by reverting the last merge. Can be reviewed by re-doing the revert or calling `git diff HEAD HEAD~2 | wc` and observing an empty diff.

ACKs for top commit:
  laanwj:
    Code review ACK fa074d2c7b9c3d34876c428d12672a505d4ce4eb

Tree-SHA512: 1a1314b9bb85f44696dc307845e80292998d6c9c000e7386c48405e74400d9cd22be6996e555f198da917e04024a1c8e609dfd830759a27fe4070168b0d272bb
2020-11-23 15:53:06 +01:00
MarcoFalke
a2fa11f9de
Merge #20166: [0.20] Backports
7566af419f3e7060152ae062f5a578f543a16a5a doc: Update data directory path comments (Hennadii Stepanov)
09261de6edd7f9fd876607fef350995052da63ba util: Add StripRedundantLastElementsOfPath function (Hennadii Stepanov)
8ef0dace867dbdc1b1dead98f0d69f64eb886d67 macOS deploy: use the new plistlib API (Jonas Schnelli)
314e79581f05881284ed9dfb661754830ed54833 build: fix mutex detection when building bdb on macOS (fanquake)
1f67a30e8374951997af924293c60eff56ae39ed random: fixes read buffer resizing in RandAddSeedPerfmon (Ethan Heilman)
6113b547f4cce8be732bf45687a74eccf4a3abfc net: Send post-verack handshake messages at most once (MarcoFalke)
bdf15d0d5d12eb33594b90ebb48366ea7bb5c3d9 rpc: Adjust witness-tx deserialize error message (MarcoFalke)
731502a18385276887a57ad8574fdbaef976920d rpc: Properly deserialize txs with witness before signing (MarcoFalke)
ee0082b886264fcddd73c5bb7c41ba8316527b9c Avoid the use of abs64 in timedata (Pieter Wuille)
05bd0c220aa0f4cb6202dd19d3164ba2e7cb015e docs: Correct description for getblockstats's txs field (Nadav Ivgi)

Pull request description:

  Backports the following PRs to the 0.20 branch:
  * https://github.com/bitcoin/bitcoin/pull/19777 - docs: Correct description for getblockstats's txs field
  * https://github.com/bitcoin/bitcoin/pull/19836 - rpc: Properly deserialize txs with witness before signing
  * https://github.com/bitcoin/bitcoin/pull/20080 - Strip any trailing `/` in -datadir and -blocksdir paths
  * https://github.com/bitcoin/bitcoin/pull/20082 - [bugfix] random: fixes read buffer to use min rather than max
  * https://github.com/bitcoin/bitcoin/pull/20141 - Avoid the use of abs64 in timedata
  * https://github.com/bitcoin/bitcoin/pull/20146 - net: Send post-verack handshake messages at most once
  * https://github.com/bitcoin/bitcoin/pull/20195 - build: fix mutex detection when building bdb on macOS
  * https://github.com/bitcoin/bitcoin/pull/20298 - macOS deploy: use the new plistlib API

  Will add additional commits as they become available.

ACKs for top commit:
  MarcoFalke:
    review ACK 7566af419f3e7060152ae062f5a578f543a16a5a 🗡

Tree-SHA512: add6bb978313c12c3e07bc232636ae9d1ab0edd0b816705c5c70eeb1cc04097165fd5e29d60c706886943ceb1f749a422020766b4aa2d23be51e9f839157a4bb
2020-11-18 10:03:04 +01:00
MarcoFalke
fa074d2c7b
Revert "Merge #19606: Backport wtxid relay to v0.20"
This reverts commit a339289c2ef9caffa1195436695a13f6e48e1bbc, reversing
changes made to b9ac31f2d29ae3e79c0f0cde5bab2d7213e6da51.
2020-11-16 07:50:27 +01:00
Hennadii Stepanov
7566af419f
doc: Update data directory path comments
Github-Pull: #20080
Rebased-From: ad5cef5dfdd5802fc187a52e74d940a52f420a51
2020-11-06 15:47:47 +08:00
Hennadii Stepanov
09261de6ed
util: Add StripRedundantLastElementsOfPath function
Co-authored-by: saibato <saibato.naga@pm.me>
Co-authored-by: MarcoFalke <falke.marco@gmail.com>

Github-Pull: 20080
Rebased-From: b19e88230f0e93e95e883e65376963cb9c36f606
2020-11-06 15:45:09 +08:00
Ethan Heilman
1f67a30e83
random: fixes read buffer resizing in RandAddSeedPerfmon
+ Replaces std::max with std::min to resize buffer in RandAddSeedPerfmon
+ Documents behavior of RandAddSeedPerfmon

Github-Pull: #20082
Rebased-From: bd5215103eb3985c1622eddea45a040e6173829c
2020-10-23 08:50:19 +08:00
MarcoFalke
6113b547f4
net: Send post-verack handshake messages at most once
Github-Pull: #20146
Rebased-From: fa1f6f237d02265af616129402fa2b8a3019dda5
2020-10-19 10:59:49 +08:00
MarcoFalke
bdf15d0d5d
rpc: Adjust witness-tx deserialize error message
Github-Pull: #19836
Rebased-From: 33330778230961cfbf2a24de36b5877e395cc596
2020-10-16 12:09:17 +08:00
MarcoFalke
731502a183
rpc: Properly deserialize txs with witness before signing
Github-Pull: #19836
Rebased-From: cccc7525697e7b8d99b545e34f0f504c78ffdb94
2020-10-16 12:06:53 +08:00
Pieter Wuille
ee0082b886
Avoid the use of abs64 in timedata
Github-Pull: #20141
Rebased-From: d1292f25f272401da0c58580521c74b1fa03a9ad
2020-10-16 11:42:27 +08:00
Nadav Ivgi
05bd0c220a
docs: Correct description for getblockstats's txs field
It does count the coinbase transaction.

Refs #19766

Github-Pull: #19777
Rebased-From: 4148f55dd016f940df50a44cf03d117cdb1dd929
2020-10-16 11:35:47 +08:00
Suhas Daftuar
d4a1ee8f1d Further improve comments around recentRejects 2020-09-24 13:24:10 +01:00
Suhas Daftuar
f082a13ab7 Disconnect peers sending wtxidrelay message after VERACK 2020-09-24 13:24:10 +01:00
Suhas Daftuar
e364b2a2d8 Rename AddInventoryKnown() to AddKnownTx() 2020-09-24 13:24:10 +01:00
Suhas Daftuar
879a3cf2c2 Make TX_WITNESS_STRIPPED its own rejection reason
Previously, TX_WITNESS_MUTATED could be returned during transaction validation
for either transactions that had a witness that was non-standard, or for
transactions that had no witness but were invalid due to segwit validation
rules.

However, for txid/wtxid-relay considerations, net_processing distinguishes the
witness stripped case separately, because it affects whether a wtxid should be
able to be added to the reject filter. It is safe to add the wtxid of a
witness-mutated transaction to the filter (as that wtxid shouldn't collide with
the txid, and hence it wouldn't interfere with transaction relay from
txid-relay peers), but it is not safe to add the wtxid (== txid) of a
witness-stripped transaction to the filter, because that would interfere with
relay of another transaction with the same txid (but different wtxid) when
relaying from txid-relay peers.

Also updates the comment explaining this logic, and explaining that we can get
rid of this complexity once there's a sufficient deployment of wtxid-relaying
peers on the network.
2020-09-24 13:24:10 +01:00
Suhas Daftuar
c1d6a1003d Delay getdata requests from peers using txid-based relay
Using both txid and wtxid-based relay with peers means that we could sometimes
download the same transaction twice, if announced via two different hashes from
different peers.

Use a heuristic of delaying txid-peer-getdata requests by 2 seconds, if we have
at least one wtxid-based peer.
2020-09-24 13:24:10 +01:00
Suhas Daftuar
181ffadd16 Add p2p message "wtxidrelay"
When sent to and received from a given peer, enables using wtxid's for
announcing and fetching transactions with that peer.
2020-09-24 13:24:10 +01:00
Anthony Towns
93826726e7 ignore non-wtxidrelay compliant invs 2020-09-24 13:24:10 +01:00
Suhas Daftuar
2599277e9c Add support for tx-relay via wtxid
This adds a field to CNodeState that tracks whether to relay transactions with
that peer via wtxid, instead of txid. As of this commit the field will always
be false, but in a later commit we will add a way to negotiate turning this on
via p2p messages exchanged with the peer.
2020-09-24 13:24:10 +01:00
Suhas Daftuar
be1b7a8916 Add wtxids to recentRejects
Previously, we only added txids to recentRejects if we were sure that the
transaction couldn't have had the wrong witness (either because the witness was
malleated or stripped).

In preparation for wtxid-based relay, we can observe that txid == wtxid for
transactions that have no witness, and add the wtxid of rejected transactions,
provided the transaction wasn't a witness-stripped one. This means that we now
add more data to the filter (as prior to this commit, any transaction with a
witness that failed to be accepted was being skipped for inclusion in the
filter) but witness malleation should still not interfere with relay of a valid
segwit transaction, because the txid of a segwit transaction would not be added
to the filter after failing validation.

In the future, having wtxids in the recent rejects filter will allow us to
skip downloading the same wtxid multiple times, once our peers use wtxids for
transaction relay.

Also add the txid to recentRejects if the transaction failed for
TX_INPUTS_NOT_STANDARD.
2020-09-24 13:24:10 +01:00
Suhas Daftuar
73845211d1 Add wtxids of confirmed transactions to bloom filter
This is in preparation for wtxid-based invs (we need to be able to tell whether
we AlreadyHave() a transaction based on either txid or wtxid).

This also double the size of the bloom filter, which is overkill, but still
uses a manageable amount of memory.
2020-09-24 13:24:10 +01:00
Suhas Daftuar
606755b840 Add wtxid-index to orphan map 2020-09-24 13:24:10 +01:00
Suhas Daftuar
3654937674 Add a wtxid-index to mapRelay 2020-09-24 13:24:10 +01:00
Suhas Daftuar
f7833b5bd8 Just pass a hash to AddInventoryKnown
Since it's only used for transactions, there's no need to pass in an inv type.
2020-09-24 13:24:10 +01:00
Suhas Daftuar
4df3d139b7 Add a wtxid-index to the mempool 2020-09-24 13:24:10 +01:00
Andrew Chow
2d48d7dcfb Simplify and fix CWallet::SignTransaction
Backport CWallet::SignTransaction from master which is simpler and not
broken.
2020-08-16 21:37:27 -04:00
Suhas Daftuar
06f9c5c3be Add txids with non-standard inputs to reject filter
Our policy checks for non-standard inputs depend only on the non-witness
portion of a transaction: we look up the scriptPubKey of the input being
spent from our UTXO set (which is covered by the input txid), and the p2sh
checks only rely on the scriptSig portion of the input.

Consequently it's safe to add txids of transactions that fail these checks to
the reject filter, as the witness is irrelevant to the failure. This is helpful
for any situation where we might request the transaction again via txid (either
from txid-relay peers, or if we might fetch the transaction via txid due to
parent-fetching of orphans).

Further, in preparation for future witness versions being deployed on the
network, ensure that WITNESS_UNKNOWN transactions are rejected in
AreInputsStandard(), so that transactions spending v1 (or greater) witness
outputs will fall into this category of having their txid added to the reject
filter.

Github-Pull: #19620
Rebased-From: 7989901c7eb62ca28b3d1e5d5831041a7267e495
2020-08-07 12:44:24 -04:00
Wladimir J. van der Laan
cac7a9809a
qt: Translation update for 0.20.1rc1
Tree-SHA512: b03b180f9ade0e6f74a722c9704725674abc8bdfdaed4579ed3b0569c6b584359a4696821d07c070887284c9876785ae92b1ccdc11fece0d505040e97fe81413
2020-07-17 15:36:41 +02:00
Andrew Chow
bad9cf8f40
Increment input value sum only once per UTXO in decodepsbt
Github-Pull: #19517
Rebased-From: 75122780e2c46505d977e24c5612dfa9442ab754
2020-07-15 12:06:43 +08:00
Pieter Wuille
2b79ac7406
Clean up separated ban/discourage interface
Github-Pull: #19219
Rebased-From: 2ad58381fffb33d611abf900b73d9e6b5a4e35f8
2020-07-08 09:10:52 +08:00
Pieter Wuille
0477348057
Replace automatic bans with discouragement filter
This patch improves performance and resource usage around IP
addresses that are banned for misbehavior. They're already not
actually banned, as connections from them are still allowed,
but they are preferred for eviction if the inbound connection
slots are full.

Stop treating these like manually banned IP ranges, and instead
just keep them in a rolling Bloom filter of misbehaving nodes,
which isn't persisted to disk or exposed through the ban
framework. The effect remains the same: preferred for eviction,
avoided for outgoing connections, and not relayed to other peers.

Also change the name of this mechanism to better reflect reality;
they're not banned, just discouraged.

Contains release notes and several interface improvements by
John Newbery.

Github-Pull: #19219
Rebased-From: b691f2df5f7d443c0c9ee056ab94aa0fc19566d5
2020-07-08 09:09:46 +08:00
João Barbosa
c9b49d2856
wallet: Handle concurrent wallet loading
Github-Pull: #19300
Rebased-From: b9971ae5853c1d62e09d976a8705f4f731290d85
2020-07-03 09:51:24 +08:00
Andrew Chow
3228b59b17
psbt: always put a non_witness_utxo and don't remove it
Offline signers will always need a non_witness_utxo so make sure it is
there.

Github-Pull: #19215
Rebased-From: 46004790588c24174a0bec49b540d158ce163ffd
2020-07-03 09:21:42 +08:00
Andrew Chow
ed5ec30804
psbt: Allow both non_witness_utxo and witness_utxo
Github-Pull: #19215
Rebased-From: 5279d8bc07d601fe6a67ad665fbc7591fe73c7de
2020-07-03 09:18:54 +08:00
Andrew Chow
68e0e6f852
rpc: show both UTXOs in decodepsbt
Github-Pull: #19215
Rebased-From: 72f6bec1da198764d4648a10a61c485e7ab65e9e
2020-07-03 09:15:42 +08:00
Russell Yanofsky
27786d072d
trivial: Suggested cleanups to surrounding code
https://github.com/bitcoin/bitcoin/pull/18982#pullrequestreview-416974841

Github-Pull: #18982
Rebased-From: 7eaf86d3bfc83f2beb3ef449707d5156853126fb
2020-06-09 21:55:27 +08:00
Russell Yanofsky
654420d6df
wallet: Minimal fix to restore conflicted transaction notifications
This fix is a based on the fix by Antoine Riard <ariard@student.42.fr> in
https://github.com/bitcoin/bitcoin/pull/18600.

Unlike that PR, which implements some new behavior, this just restores previous
wallet notification and status behavior for transactions removed from the
mempool because they conflict with transactions in a block. The behavior was
accidentally changed in two `CWallet::BlockConnected` updates:
a31be09bfd77eed497a8e251d31358e16e2f2eb1 and
7e89994133725125dddbfa8d45484e3b9ed51c6e from
https://github.com/bitcoin/bitcoin/pull/16624, causing issue
https://github.com/bitcoin/bitcoin/issues/18325.

The change here could be improved and replaced with a more comprehensive
cleanup, so it includes a detailed comment explaining future considerations.

Fixes #18325

Co-authored-by: Antoine Riard <ariard@student.42.fr>

Github-Pull: #18982
Rebased-From: b604c5c8b5892842f13dee89ae31812a28ab25d1
2020-06-09 21:12:38 +08:00
Samuel Dobson
febebc4ea6
Fix WSL file locking by using flock instead of fcntl
Co-authored-by: sipa <pieter@wuille.net>

Github-Pull: #18700
Rebased-From: e8fa0a3d2025509fcddc59fc618e91371542cf87
2020-06-09 21:09:22 +08:00
MIZUTA Takeshi
0596a6eeb5
util: Don't reference errno when pthread fails.
Pthread library does not set errno.
Pthread library's errno is returned by return value.

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>

Github-Pull: #19194
Rebased-From: cb38b069b0f41b1a26264784b1c1303c8ac6ab08
2020-06-09 21:06:15 +08:00
MarcoFalke
cd32134bda
Merge #19170: [0.20] Add missing QPainterPath include
384d3f991c9bdeec6eb4685df5918877dbbe7634 Add missing QPainterPath include (Andrew Chow)

Pull request description:

  This is needed to compile with Qt 5.15.

  Github-Pull: #19097
  Rebased-From: 79b0a69e09c1a912122e6431ea3c530cc292c690

Top commit has no ACKs.

Tree-SHA512: 23c4604cddb0bf5955afa6dfb6be87989df591e5f5ca5b85257c72e916f29337012b24c9ab5374a3289700ab7518ddb48f21195a2173ea1f935d69bd2ad13b8b
2020-06-04 18:21:28 -04:00