Commit Graph

23599 Commits

Author SHA1 Message Date
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
Wladimir J. van der Laan
80aa83aa40 Merge #20008: [Backport] #19839 and #19842 to v0.20
498b7cb6f3 Update the vcpkg checkout commit ID in appveyor config. (Aaron Clauson)
ad99777b57 Set appveyor vm version to previous Visual Studio 2019 release. (Aaron Clauson)

Pull request description:

  Required for appveyor builds to succeed for other v0.20 backports. For example #19606 fails to build on appveyor without these commits, and succeeds with them.

  The first commit is actually reversed by the second commit (which also changes `VCPKG_COMMIT_ID`), but I'm backporting them both so that they're clean cherrypicks.

ACKs for top commit:
  laanwj:
    ACK 498b7cb6f3

Tree-SHA512: 723a834fd86c8b5f58e71b9f1abfa8b3ad67376fab8e7d3699330142a6fde98547209b2b5fa6fdf9b934a447b29bf866e2258d0c303cec1062401e924e83f297
2020-09-24 14:07:47 +02:00
Aaron Clauson
498b7cb6f3 Update the vcpkg checkout commit ID in appveyor config. 2020-09-24 09:34:33 +01:00
Aaron Clauson
ad99777b57 Set appveyor vm version to previous Visual Studio 2019 release.
Latest vm version has updated cmake and the berkeleydb vcpkg now fails to build.
2020-09-24 09:34:33 +01:00
fanquake
30926997fa Merge #19680: 0.20: Add txids with non-standard inputs to reject filter
107cf1515e test addition of unknown segwit spends to txid reject filter (Gregory Sanders)
06f9c5c3be Add txids with non-standard inputs to reject filter (Suhas Daftuar)

Pull request description:

  Backport of #19620 to 0.20.

ACKs for top commit:
  instagibbs:
    utACK 107cf1515e
  fjahr:
    utACK 107cf1515e
  jnewbery:
    utACK 107cf1515e

Tree-SHA512: d89c75fefdb6b50f40adfcf3cfdb2a791122e4d6a5903cb553c664042963577beb97a73319f9d1cb8320d32846778233c95255812c37fb4c7b1b25da161a6595
2020-09-04 20:11:47 +08:00
Gregory Sanders
107cf1515e test addition of unknown segwit spends to txid reject filter
Github-Pull: #19620
Rebased-From: 9f88ded82b
2020-08-07 12:45:03 -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: 7989901c7e
2020-08-07 12:44:24 -04:00
Wladimir J. van der Laan
bf0dc356ac Merge #19636: doc: Update 0.20.1 release notes with psbt changes
7c1c15329e doc: Update 0.20.1 release notes with psbt changes (Andrew Chow)

Pull request description:

  #19215 was missing from the list. Also felt it was important to mention this change.

Top commit has no ACKs.

Tree-SHA512: b795cf73954ff493747a793039918a5e19c377d9325e6156a8e23ba8f510af12f48b2d63854f57d482640531a865190f1fe1ece0c78a5e45d6926f9533c6d695
2020-08-01 14:15:21 +02:00
Andrew Chow
7c1c15329e doc: Update 0.20.1 release notes with psbt changes 2020-07-31 18:03:24 -04:00
Wladimir J. van der Laan
7ff64311be build: Bump version to 0.20.1-final
Tree-SHA512: 7edd91cdb03cf55201987775e5d14bfa61e3eff54abd04eaf249889e5216b12ad722188e12bb51eabb81bcd66014fd349484533744dc777e7af68a78fbc7f51b
v0.20.1
2020-07-31 14:02:21 +02:00
MarcoFalke
6acb21e724 Merge #19612: [0.20] lint: fix shellcheck URL in CI install
7ee4769cd4 [0.20] lint: fix shellcheck URL in CI install (fanquake)

Pull request description:

  This is causing the tests to fail for backports i.e #19606. If you look in the Travis logs there, the output is:
  ```bash
  You are downloading ShellCheck from an outdated URL!
  Please update to the new URL:
  https://github.com/koalaman/shellcheck/releases/download/v0.6.0/shellcheck-v0.6.0.linux.x86_64.tar.xz
  For more information, see:
  https://github.com/koalaman/shellcheck/issues/1871
  PS: Sorry for breaking your build. The hosting costs were getting out of hand :(
  ```

ACKs for top commit:
  MarcoFalke:
    review ACK 7ee4769cd4

Tree-SHA512: 62470291e53954ab541a7109e530390410d9b8a4d3ed6f4128ab8807d2225f368b8c984342f92de802a60dd082292cb59557599b4112413a29fc9ad8e8bcd0ee
2020-07-28 14:21:44 +02:00
fanquake
7ee4769cd4 [0.20] lint: fix shellcheck URL in CI install
This is causing the tests to fail for backports etc.
2020-07-28 20:13:06 +08:00
Wladimir J. van der Laan
58feb9ecb6 doc: Add changelog and authors to release notes for 0.20.1
Tree-SHA512: 39bbead4040097dd8aeac13bed57ad5e698aa2453883d8259930399e3c0f51168913a991f303a3407b649cfbf6e223291ca0942119514060e9a164bd05fa91f5
2020-07-23 18:30:00 +02:00
Wladimir J. van der Laan
cac7a9809a qt: Translation update for 0.20.1rc1
Tree-SHA512: b03b180f9ade0e6f74a722c9704725674abc8bdfdaed4579ed3b0569c6b584359a4696821d07c070887284c9876785ae92b1ccdc11fece0d505040e97fe81413
v0.20.1rc1
2020-07-17 15:36:41 +02:00
Wladimir J. van der Laan
5e21c55ef0 doc: Regenerate man pages for 0.20.1rc1
Tree-SHA512: 9707cb25e7020d9db6005066675256ee34c689cf8f04586051501bb3a89f2c4eee222a39cd4c2a648dca8274f0fcf2d6aeee010cd3525ca8edae2ad2ffae9811
2020-07-17 15:33:17 +02:00
Wladimir J. van der Laan
cd34ff5464 build: Bump version to 0.20.1rc1
Tree-SHA512: 643ff61093258641e0d69456cc6fbb8c47801af494aacbf3d3f6401ce9ea8f171d27b0703845fd581dbda8037b97c2b428ed92853909d49f251a4666fe8dae9a
2020-07-17 15:07:25 +02:00
Hennadii Stepanov
8b40937493 qt: Fix QFileDialog for static builds
This change partially reverts 248e22bbc0.

Github-Pull: #19536
Rebased-From: 6457361e90
Tree-SHA512: 3b48c64f59068d70b3aec4514ebe4a091813c77518a52a81bd8a36b44d0854b3f5e187f52c0f8e4527506087cb7e2cafb7c39cb7d28e4b8f620a77980e8a4697
2020-07-17 15:00:23 +02:00
Wladimir J. van der Laan
f61398a978 Merge #19524: [0.20] Backport #19517 - Increment input value sum only once per UTXO in decodepsbt
bad9cf8f40 Increment input value sum only once per UTXO in decodepsbt (Andrew Chow)

Pull request description:

  Github-Pull: #19517
  Rebased-From: 75122780e2

ACKs for top commit:
  jnewbery:
    utACK bad9cf8f40
  laanwj:
    ACK bad9cf8f40

Tree-SHA512: 543bbe58f2dafc772289708007d72fa61592270f3de083afffb9a56274b03f2ffe8d8d509a93790ceea3a708e1c02b1ad941e23281b3db1f48766c01a930dbd6
2020-07-16 20:06:31 +02:00
Andrew Chow
bad9cf8f40 Increment input value sum only once per UTXO in decodepsbt
Github-Pull: #19517
Rebased-From: 75122780e2
2020-07-15 12:06:43 +08:00
fanquake
2f6c7c0f6f Merge #19482: doc: move-only release notes for 0.20.1
fae0e93836 Remove cached directories and associated script blocks from appveyor CI configuration. (Aaron Clauson)
faf5e256c5 appveyor: Remove clcache (MarcoFalke)
888886ed5b doc: move-only release notes for 0.20.1 (MarcoFalke)
fa39988598 doc: Clear release notes for minor release (MarcoFalke)

Pull request description:

  Also fix appveyor

ACKs for top commit:
  fanquake:
    ACK fae0e93836

Tree-SHA512: 93840aaea9163a90bacf58bd1428fd5dda1187daabfa691d5d03e4abf00238d935c10c9d420ae7f9776d78f9fb2c6eb03f4bf1655ebe03483c224ab1fe851b84
2020-07-15 11:37:36 +08:00
Aaron Clauson
fae0e93836 Remove cached directories and associated script blocks from appveyor CI configuration.
Github-Pull: #19444
Rebased-From: 961e667600
2020-07-10 13:57:31 +02:00
MarcoFalke
faf5e256c5 appveyor: Remove clcache
Github-Pull: #18640
Rebased-From: fac0c8db9f
2020-07-10 13:57:22 +02:00
MarcoFalke
888886ed5b doc: move-only release notes for 0.20.1 2020-07-10 13:53:54 +02:00
MarcoFalke
fa39988598 doc: Clear release notes for minor release 2020-07-10 13:53:51 +02:00
fanquake
01c563708f Merge #19224: [0.20] Backports
2b79ac7406 Clean up separated ban/discourage interface (Pieter Wuille)
0477348057 Replace automatic bans with discouragement filter (Pieter Wuille)
e7f06f9b0e test: remove Cirrus CI FreeBSD job (fanquake)
eb6b82a558 qa: Test concurrent wallet loading (João Barbosa)
c9b49d2856 wallet: Handle concurrent wallet loading (João Barbosa)
cf0b5a933d tests: Check that segwit inputs in psbt have both UTXO types (Andrew Chow)
3228b59b17 psbt: always put a non_witness_utxo and don't remove it (Andrew Chow)
ed5ec30804 psbt: Allow both non_witness_utxo and witness_utxo (Andrew Chow)
68e0e6f852 rpc: show both UTXOs in decodepsbt (Andrew Chow)
27786d072d trivial: Suggested cleanups to surrounding code (Russell Yanofsky)
654420d6df wallet: Minimal fix to restore conflicted transaction notifications (Russell Yanofsky)
febebc4ea6 Fix WSL file locking by using flock instead of fcntl (Samuel Dobson)
5c7151a604 gui: update Qt base translations for macOS release (fanquake)
c219d21634 build: improved output of configure for build OS (sachinkm77)
0596a6eeb5 util: Don't reference errno when pthread fails. (MIZUTA Takeshi)

Pull request description:

  Currently backports the following to the 0.20 branch:
  * #18700 - Fix locking on WSL using flock instead of fcntl
  * #18982 - wallet: Minimal fix to restore conflicted transaction notifications
  * #19059 - gui: update Qt base translations for macOS release
  * #19152 - build: improve build OS configure output
  * #19194 -  util: Don't reference errno when pthread fails.
  * #19215 - psbt: Include and allow both non_witness_utxo and witness_utxo for segwit inputs
  * #19219 - Replace automatic bans with discouragement filter
  * #19300 - wallet: Handle concurrent wallet loading

ACKs for top commit:
  amitiuttarwar:
    ACK 0477348057 2b79ac7406 by comparing to original changes, double checking the diff
  sipa:
    utACK 2b79ac7406
  laanwj:
    ACK 2b79ac7406

Tree-SHA512: e5eb31d08288fa4a6e8aba08e60b16ce1988f14f249238b1cfd18ab2c8f6fcd9f07e3c0c491d32d2361fca26e3037fb0374f37464bddcabecea29069d6737539
2020-07-10 12:45:47 +08:00
Pieter Wuille
2b79ac7406 Clean up separated ban/discourage interface
Github-Pull: #19219
Rebased-From: 2ad58381ff
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: b691f2df5f
2020-07-08 09:09:46 +08:00
fanquake
e7f06f9b0e test: remove Cirrus CI FreeBSD job
This has been removed from the master branch, and always seems to fail
at the installing packages phase. i.e:
```bash
pkg install -y autoconf automake boost-libs git gmake libevent libtool pkgconf python3 ccache
Updating FreeBSD repository catalogue...
Fetching meta.txz: . done
pkg: repository meta /var/db/pkg/FreeBSD.meta has wrong version 2
repository FreeBSD has no meta file, using default settings
Fetching packagesite.txz: .......... done
pkg: repository meta /var/db/pkg/FreeBSD.meta has wrong version 2
pkg: Repository FreeBSD load error: meta cannot be loaded No error: 0
Unable to open created repository FreeBSD
Unable to update repository FreeBSD
Error updating repositories!

Exit status: 3
```
2020-07-03 09:59:33 +08:00
João Barbosa
eb6b82a558 qa: Test concurrent wallet loading
Github-Pull: #19300
Rebased-From: 9b009fae6e
2020-07-03 09:58:17 +08:00
João Barbosa
c9b49d2856 wallet: Handle concurrent wallet loading
Github-Pull: #19300
Rebased-From: b9971ae585
2020-07-03 09:51:24 +08:00
Andrew Chow
cf0b5a933d tests: Check that segwit inputs in psbt have both UTXO types
Github-Pull: #19215
Rebased-From: 84d295e513
2020-07-03 09:22:21 +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: 4600479058
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: 5279d8bc07
2020-07-03 09:18:54 +08:00
Andrew Chow
68e0e6f852 rpc: show both UTXOs in decodepsbt
Github-Pull: #19215
Rebased-From: 72f6bec1da
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: 7eaf86d3bf
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:
a31be09bfd and
7e89994133 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: b604c5c8b5
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: e8fa0a3d20
2020-06-09 21:09:22 +08:00
fanquake
5c7151a604 gui: update Qt base translations for macOS release
These haven't been updated since their addition, so this updates the list that
controls which qt base translations are bundled with the macOS binary, to all the
languages that are available with qt 5.9.8.

This could probably be improved in some way, however qt updates are infrequent,
and I didn't want to spend any more time looking at this. Also given that no-one
seems to have noticed and/or reported this it wouldn't seem high-priority.

Could be backported to 0.20.1.

Github-Pull: #19059
Rebased-From: 69bfcac27a
2020-06-09 21:08:32 +08:00
sachinkm77
c219d21634 build: improved output of configure for build OS
Github-Pull: #19152
Rebased-From: 0fef60c63d
2020-06-09 21:07:45 +08:00