Commit graph

32610 commits

Author SHA1 Message Date
Jeremy Rubin
cfa575266b Optimize CHECKSIGADD Script Validation 2022-01-19 15:21:52 -08:00
Andrew Chow
dc5d6b0d47 fs: Make compatible with boost 1.78 2022-01-19 16:25:20 -05:00
w0xlt
1dfd31bc26 scripted-diff: rename m_cs_chainstate -> m_chainstate_mutex
-BEGIN VERIFY SCRIPT-
s() { sed -i 's/m_cs_chainstate/m_chainstate_mutex/g' $1; }
s src/validation.cpp
s src/validation.h
-END VERIFY SCRIPT-
2022-01-19 14:43:15 -03:00
MarcoFalke
fa2bcc4e42
Run coin.IsSpent only once in a row
Follow-up to commit 64e4963c63
2022-01-19 16:55:53 +01:00
MarcoFalke
06b6369766
Merge bitcoin/bitcoin#23976: document and clean up MaybeUpdateMempoolForReorg
e177fcab38 Replace `struct update_lock_points` with lambda (glozow)
c7cd98c717 document and clean up MaybeUpdateMempoolForReorg (glozow)

Pull request description:

  followup to #23683, addressing https://github.com/bitcoin/bitcoin/pull/23683#issuecomment-989741186

ACKs for top commit:
  hebasto:
    ACK e177fcab38, I have reviewed the code and it looks OK, I agree it can be merged.
  instagibbs:
    ACK e177fcab38
  MarcoFalke:
    Approach ACK e177fcab38 😶

Tree-SHA512: 8c2709dd5cab73cde41f3e5655d5f237bacfb341f78eac026169be579528695ca628c8777b7d89760d8677a4e6786913293681cfe16ab702b30c909703e1824c
2022-01-19 15:31:58 +01:00
fanquake
ae9175f608
build: add FreeBSD support to depends 2022-01-19 20:38:07 +08:00
fanquake
2d7ffce852
Merge bitcoin/bitcoin#24093: build: specify hosts for qrencode package
bf044ef9ec build: specify hosts for qrencode package (fanquake)

Pull request description:

  Similar to how we specify the OS's we build Qt for, specify which OS's
  we will build qrencode for (a qt dependency). This commit alone doesn't
  change anything, but when we start supporting other OS's, i.e #23948,
  where we wont support qt (or at least initially), it'll skip building
  the qrencode package, which would be unused.

  I'll rebase the other *BSD changes on top of this.

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

Tree-SHA512: 3f5f11f122704a664dd77d8da0b7e9b95d44b2f1514d0199deed9b8b8ad0d8883a1de1f444b796c5f4681f423a380c3905fce720d7d2b788130162c907c2ce3b
2022-01-19 20:37:30 +08:00
w0xlt
5e7e4c9f6e refactor: replace RecursiveMutex g_maplocalhost_mutex with Mutex 2022-01-19 07:06:36 -03:00
w0xlt
a7da1409bc scripted-diff: rename cs_mapLocalHost -> g_maplocalhost_mutex
-BEGIN VERIFY SCRIPT-
s() { sed -i 's/cs_mapLocalHost/g_maplocalhost_mutex/g' $1; }
s src/net.cpp
s src/net.h
s src/rpc/net.cpp
s src/test/net_tests.cpp
-END VERIFY SCRIPT-
2022-01-19 07:04:52 -03:00
MarcoFalke
5c3bfee46a
Merge bitcoin/bitcoin#24054: test: rest /tx with an invalid/unknown txid
bd52684508 test: rest /tx with an invalid/unknown txid (brunoerg)

Pull request description:

  This PR adds test coverage to the endpoint `/tx` (rest) passing an invalid and an unknown txid to test its return.
  Invalid -> should return status code 400 (bad request)
  Unknown -> should return status code 404 (not found)

ACKs for top commit:
  kallewoof:
    ACK bd52684508

Tree-SHA512: a7fbb63f30d06fc0855133a36e8317c7930ba13aa2b4a2dd1fc35079d59eacace72e1ffe7ae1b3e067066fe51792415940d72d923e83a659a0d5965e4110b32a
2022-01-19 08:42:42 +01:00
Andrew Chow
869c6e23c5
Merge bitcoin/bitcoin#22317: doc: Highlight DNS requests part in tor.md
86a4a15bdc Highlight DNS request part (Prayank)

Pull request description:

  _What?_

  Highlight DNS requests part in Proxy section

  _Why?_

  1. DNS requests are very important while considering privacy
  2. Lot of users might skip reading it because of the way it is mixed with everything else in the doc right now
  3. I have seen lot of users ignoring DNS requests or unaware of such things while using privacy tools

  _How?_

  Initially I had tried keeping these lines separate from code block but [Jonatack didn't agree with the changes](https://github.com/bitcoin/bitcoin/pull/21157#discussion_r618177116). Harding suggested using [bold/italic in `<pre></pre>`](https://github.com/bitcoin/bitcoin/pull/21157#discussion_r644364143). I have used the suggestions from previous PR and added `---`

  This is a part of alternative described in https://github.com/bitcoin/bitcoin/pull/22316

ACKs for top commit:
  jonatack:
    ACK 86a4a15bdc
  Rspigler:
    ACK 86a4a15bdc
  achow101:
    ACK 86a4a15bdc
  RiccardoMasutti:
    ACK 86a4a15
  lsilva01:
    ACK 86a4a15bdc
  kristapsk:
    ACK 86a4a15bdc
  theStack:
    ACK 86a4a15bdc

Tree-SHA512: a4fe0e8c08df330e5ca78ce19ce74be7034c653f4374469d928908847a6debf385283e3a6da66de600566c7bab6290ccd35df26864aef94cbb3f294123391437
2022-01-18 14:31:50 -05:00
MarcoFalke
b24aa9c8ef
Merge bitcoin/bitcoin#24095: util: Fix mis-swapped prettyIndent and indentLevel arguments
f251141483 util: Fix mis-swapped `prettyIndent` and `indentLevel` arguments (Hennadii Stepanov)

Pull request description:

  On master d0bf9bb6a5:
  ```
  $ cat settings.json
  {
      "wallet": [
       "210803d"
      ]
     }
  ```

  With this PR:
  ```
  $ cat settings.json
  {
      "wallet": [
          "210803d"
      ]
  }
  ```

ACKs for top commit:
  ryanofsky:
    Code review ACK f251141483. Nice catch!

Tree-SHA512: 1c315c807a070039c05a77f4e8855011d468b9aeb141e4fa3b1e1aaaab252e3831e8bdfe0caddf7704a00492799022f761f6d21a047c5bf75cdbcc96f04fc04e
2022-01-18 17:57:33 +01:00
Shashwat
f7a19ef774 qt,refactor: Use std::chrono in TrafficGraphWidget class 2022-01-18 20:03:50 +05:30
Hennadii Stepanov
f251141483
util: Fix mis-swapped prettyIndent and indentLevel arguments 2022-01-18 15:47:46 +02:00
glozow
e177fcab38 Replace struct update_lock_points with lambda
No behavior change.
This code was introduced in 5add7a7 before we required C++11, which is
why the struct was needed. As we are now using more modern C++ and this
is the only place where lockpoints are updated for mempool entries, it
is more idiomatic to call `modify` with a lambda.

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
2022-01-18 11:55:15 +00:00
glozow
c7cd98c717 document and clean up MaybeUpdateMempoolForReorg
Co-authored-by: John Newbery <john@johnnewbery.com>
2022-01-18 11:55:06 +00:00
fanquake
bf044ef9ec
build: specify hosts for qrencode package
Similar to how we specify the OS's we build Qt for, specify which OS's
we will build qrencode for (a qt dependency). This commit alone doesn't
change anything, but when we start supporting other OS's, i.e #23948,
where we wont support qt (or at least initially), it'll skip building
the qrencode package, which would be unused.
2022-01-18 15:30:31 +08:00
glozow
3cd7f693d3 [unit test] package parents are a mix 2022-01-17 13:00:19 +00:00
glozow
de075a98ea [validation] better handle errors in SubmitPackage
Behavior change: don't quit right after LimitMempoolSize() when a
package is partially submitted. We should still send
TransactionAddedToMempool notifications for
transactions that were submitted.

Not behavior change: add a new package validation result for mempool logic errors.
2022-01-17 12:24:43 +00:00
glozow
9d88853e0c AcceptPackage fixups
No behavior changes, just clarifications.
2022-01-17 12:24:43 +00:00
glozow
2db77cd3b8 [unit test] different witness in package submission
If/when witness replacement is implemented in the future, this test case
can be easily replaced with witness replacement tests.
2022-01-17 12:24:43 +00:00
glozow
9ad211c575 [doc] more detailed explanation for deduplication 2022-01-17 12:17:51 +00:00
glozow
83d4fb7126 [packages] return DIFFERENT_WITNESS for same-txid-different-witness tx
The previous interface required callers to guess that the tx had been
swapped and look up the tx again by txid to find a `MEMPOOL_ENTRY`
result. This is a confusing interface.

Instead, explicitly tell the caller that this transaction was
`DIFFERENT_WITNESS` in the result linked to the mempool entry's wtxid.
This gives the caller all the information they need in 1 lookup, and
they can query the mempool for the other transaction if needed.
2022-01-17 12:17:50 +00:00
MarcoFalke
d0bf9bb6a5
Merge bitcoin/bitcoin#23373: test: Parse command line arguments from unit and fuzz tests, make addrman consistency check ratio easier to change
7f122a4188 fuzz: non-addrman fuzz tests: override-able check ratio (Vasil Dimov)
3bd83e273d fuzz: addrman fuzz tests: override-able check ratio (Vasil Dimov)
46b0fe7829 test: non-addrman unit tests: override-able check ratio (Vasil Dimov)
81e4d54d3a test: addrman unit tests: override-able check ratio (Vasil Dimov)
6dff6214be bench: put addrman check ratio in a variable (Vasil Dimov)
6f7c7567c5 fuzz: parse the command line arguments in fuzz tests (Vasil Dimov)
92a0f7e58d test: parse the command line arguments in unit tests (Vasil Dimov)

Pull request description:

  Previously command line arguments passed to unit and fuzz tests would be ignored by the tests themselves. They would be used by the boost test framework (e.g. `--run_test="addrman_tests/*"`) or by the fuzzer (e.g. `-runs=1`). However both provide ways to pass down the extra arguments to the test itself. Use that, parse the arguments and make them available to the tests via `gArgs`.

  This makes the tests more flexible as they can be run with any bitcoind config option specified on the command line.

  When creating `AddrMan` objects in tests, use `-checkaddrman=` (if provided) instead of hardcoding the check ratio in many different places. See https://github.com/bitcoin/bitcoin/pull/20233#issuecomment-889813074 for further motivation for this.

ACKs for top commit:
  mzumsande:
    re-ACK 7f122a4188
  josibake:
    reACK 7f122a4188

Tree-SHA512: 3a05e61e4d70a0569bb67594bcce3aad8fdef63cdcc54e2823a3bc9f18679571985004412b6c332a210f67849bab32d8467b4115fbff8f5fac9834982e60dcf3
2022-01-17 09:10:21 +01:00
S3RK
3b98bf9c43 Revert "Add to spends only transcations from me"
This reverts commit d04566415e.
2022-01-17 08:54:08 +01:00
MarcoFalke
427e9c9435
Merge bitcoin/bitcoin#24069: refactor: replace RecursiveMutex m_cs_callbacks_pending with Mutex (and rename)
5574e6ed52 refactor: replace RecursiveMutex `m_callbacks_mutex` with Mutex (Sebastian Falbesoner)
3aa258109e scripted-diff: rename `m_cs_callbacks_pending` -> `m_callbacks_mutex` (Sebastian Falbesoner)

Pull request description:

  This PR is related to #19303 and gets rid of the RecursiveMutex `m_cs_callbacks_pending`. All of the critical sections (6 in total) only directly access the guarded elements, i.e. it is not possible that within one section another one is called, and we can use a regular Mutex:

  807169e10b/src/scheduler.cpp (L138-L145)

  807169e10b/src/scheduler.cpp (L152-L160)

  807169e10b/src/scheduler.cpp (L169-L172)

  807169e10b/src/scheduler.cpp (L184-L187)

  807169e10b/src/scheduler.cpp (L197-L199)

  807169e10b/src/scheduler.cpp (L203-L206)

  Also, it is renamed to adapt to the (unwritten) naming convention to use the `_mutex` suffix rather than the `cs_` prefix.

ACKs for top commit:
  hebasto:
    ACK 5574e6ed52, I have reviewed the code and it looks OK, I agree it can be merged.
  w0xlt:
    crACK 5574e6e

Tree-SHA512: ba4b151d956582f4c7183a1d51702b269158fc5e2902c51e6a242aaeb1c72cfcdf398f9ffa42e3072f5aba21a8c493086a5fe7c450c271322da69bd54c37ed1f
2022-01-17 08:53:48 +01:00
MarcoFalke
dbf81a73e3
Merge bitcoin/bitcoin#24079: refactor: replace RecursiveMutex cs_SubVer with Mutex (and rename)
30927cb530 refactor: replace RecursiveMutex `m_subver_mutex` with Mutex (Sebastian Falbesoner)
0639aba42a scripted-diff: rename `cs_SubVer` -> `m_subver_mutex` (Sebastian Falbesoner)

Pull request description:

  This PR is related to #19303 and gets rid of the RecursiveMutex `cs_SubVer`. Both of the critical sections only directly access the guarded variable, i.e. it is not possible that within one section another one is called, and we can use a regular Mutex.

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

Tree-SHA512: 2faead792ea0b2f79f9f7fe99acde5cf2bfcd2f15c51fbb6cb1099d4f81276001a492f7d46a5139055f4366c2d58a36a8ba19f21d56df20e0ed93af3141dbe11
2022-01-17 08:50:40 +01:00
MarcoFalke
92a71f65be
Merge bitcoin/bitcoin#24059: Fix implicit-integer-sign-change in arith_uint256
fa99e108e7 Fix implicit-integer-sign-change in arith_uint256 (MarcoFalke)

Pull request description:

  This refactor doesn't change behaviour, but clarifies that the numbers being dealt with aren't supposed to be negative. This helps when reading the code and allows to remove a sanitizer suppression for the whole file.

ACKs for top commit:
  PastaPastaPasta:
    utACK fa99e108e7
  shaavan:
    ACK fa99e108e7

Tree-SHA512: f227e2fd22021e39f0445ec041f4a299d13477c23cef0fc06c53fb3313cbe550cec329336224a7e8775d9045b8009423052b394e83d42a1e40772085dfcdd471
2022-01-17 08:48:23 +01:00
MarcoFalke
dfe1341c57
Merge bitcoin/bitcoin#24033: log: Remove GetAdjustedTime from IBD header progress estimation
fac22fd36b log: Remove GetAdjustedTime from IBD header progress estimation (MarcoFalke)

Pull request description:

  This is a "refactor" that shouldn't change behaviour, because the two times are most likely equal. A minimum of 5 outbound peers are needed to adjust the time. And if the time is adjusted, it will be by at most 70 minutes (`DEFAULT_MAX_TIME_ADJUSTMENT`). Thus, the progress estimate should differ by at most 7 blocks.

ACKs for top commit:
  laanwj:
    Code review ACK fac22fd36b
  vincenzopalazzo:
    ACK fac22fd36b

Tree-SHA512: bf9f5eef66db0110dd268cf6dbfab64b9c11ba776924f5b386ceae3f2d005272cceb87ebcc96e0c8b854c051514854a2a5af39ae43bad008fac685b5aafaabd0
2022-01-17 08:46:47 +01:00
MarcoFalke
7de2cf9b25
Merge bitcoin/bitcoin#23992: fuzz: Limit fuzzed time to years 2000-2100
fa7238300c fuzz: Limit fuzzed time to years 2000-2100 (MarcoFalke)

Pull request description:

  It doesn't make sense to fuzz times in the past, as Bitcoin Core will refuse to start in the past.

  Fix that and also remove a sanitizer suppression, which would be hit in net_processing in `ProcessMessage`:

  ```cpp

               if (addr.nTime <= 100000000 || addr.nTime > nNow + 10 * 60)
                   addr.nTime = nNow - 5 * 24 * 60 * 60; // <-- Here
  ```

  This changes the format of fuzz inputs. Previously a time value was (de)serialized as 40 bytes, now it is 32 bytes.

ACKs for top commit:
  mzumsande:
    Code Review ACK fa7238300c

Tree-SHA512: ca6e7233beec2d9ef9fd481d8f1331942a4d2c8fe518b857629bebcc53a4f42ae123b994cf5d359384a0a8022098ff5a9c146600bc2593c6d88734e25bc240ad
2022-01-17 08:43:16 +01:00
fanquake
4a062508b7
Merge bitcoin/bitcoin#24068: doc: Rework 14707 release notes
fa4c72e706 doc: Rework 14707 release notes (MarcoFalke)
fa9377c746 doc: move-only release note snippets (MarcoFalke)

Pull request description:

  Requested by myself in https://github.com/bitcoin/bitcoin/pull/14707/files#r764313750

ACKs for top commit:
  andrewtoth:
    ACK fa4c72e706

Tree-SHA512: 091b9cb511ed3bef1e3d48ba5917ee23dd4bbb0f1daf999ca2b429fcff57b8876375b8579ac0a8ec438dc5c75d536d6d27074f325f51ffd38b0edc284d0c0155
2022-01-17 11:02:47 +08:00
Sebastian Falbesoner
30927cb530 refactor: replace RecursiveMutex m_subver_mutex with Mutex
In each of the critical sections, only the the guarded variable is
accessed, without any chance that within one section another one is
called.  Hence, we can use an ordinary Mutex instead of RecursiveMutex.
2022-01-16 16:49:13 +01:00
Sebastian Falbesoner
0639aba42a scripted-diff: rename cs_SubVer -> m_subver_mutex
-BEGIN VERIFY SCRIPT-
sed -i 's/cs_SubVer/m_subver_mutex/g' ./src/net.h ./src/net.cpp ./src/net_processing.cpp
-END VERIFY SCRIPT-
2022-01-16 16:47:11 +01:00
Hennadii Stepanov
224d87855e
net, refactor: Drop tautological local variables 2022-01-15 21:03:00 +02:00
Hennadii Stepanov
3073a9917b
scripted-diff: Rename CNetMessage::m_command with CNetMessage::m_type
-BEGIN VERIFY SCRIPT-
sed -i 's/std::string m_command;/std::string m_type;/g' ./src/net.h
sed -i 's/* command and size./* type and size./g' ./src/net.h
sed -i 's/msg.m_command/msg.m_type/g' ./src/net.cpp ./src/net_processing.cpp ./src/test/fuzz/p2p_transport_serialization.cpp
-END VERIFY SCRIPT-
2022-01-15 20:59:19 +02:00
fanquake
e2ab9f83f8
build: disable external signer on Windows 2022-01-15 10:02:04 +08:00
Anthony Towns
a380922891 Release notes for getdeploymentinfo rpc 2022-01-15 04:37:56 +10:00
Anthony Towns
240cad09ba rpc: getdeploymentinfo: include signalling info 2022-01-15 04:37:56 +10:00
Anthony Towns
376c0c6dae rpc: getdeploymentinfo: include block hash/height 2022-01-15 04:37:56 +10:00
Anthony Towns
a7469bcd35 rpc: getdeploymentinfo: change stats to always refer to current period
On a period boundary, getdeploymentinfo (and previously getblockchaininfo)
would report the status and statistics for the next block rather than
the current block. Change this to always report the status/statistics
of the current block, but add status-next to report the status for the
next block.
2022-01-15 04:37:56 +10:00
Anthony Towns
7f15c1841b rpc: getdeploymentinfo: allow specifying a blockhash other than tip 2022-01-15 04:37:56 +10:00
Anthony Towns
fd826130a0 rpc: move softfork info from getblockchaininfo to getdeploymentinfo 2022-01-15 04:37:56 +10:00
Sebastian Falbesoner
5574e6ed52 refactor: replace RecursiveMutex m_callbacks_mutex with Mutex
In each of the critical sections, only the the guarded variables are
accessed, without any chance that within one section another one is
called.  Hence, we can use an ordinary Mutex instead of RecursiveMutex.
2022-01-14 13:27:41 +01:00
Sebastian Falbesoner
3aa258109e scripted-diff: rename m_cs_callbacks_pending -> m_callbacks_mutex
-BEGIN VERIFY SCRIPT-
sed -i 's/m_cs_callbacks_pending/m_callbacks_mutex/g' ./src/scheduler.h ./src/scheduler.cpp
-END VERIFY SCRIPT
2022-01-14 13:25:23 +01:00
MarcoFalke
fa4c72e706
doc: Rework 14707 release notes 2022-01-14 12:37:44 +01:00
MarcoFalke
fa9377c746
doc: move-only release note snippets
Can be reviewed with
--color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
2022-01-14 12:36:42 +01:00
MarcoFalke
888841ea8d
interfaces: Remove unused is_final 2022-01-14 11:28:45 +01:00
MarcoFalke
dddd05e7a3
qt: Treat unconfirmed txs as unconfirmed 2022-01-14 11:24:58 +01:00
brunoerg
bd52684508 test: rest /tx with an invalid/unknown txid 2022-01-13 17:00:18 -03:00
MarcoFalke
807169e10b
Merge bitcoin/bitcoin#24035: test: use MiniWallet for mempool_accept.py
aa8a65e4a8 test: use MiniWallet for mempool_accept.py (Sebastian Falbesoner)
b24f6c6855 test: MiniWallet: support default `from_node` for creating txs (Sebastian Falbesoner)
f30041c914 test: create txs with current `nVersion` (2) by default (Sebastian Falbesoner)
2f79786822 test: refactor: add constant for sequence number `SEQUENCE_FINAL` (Sebastian Falbesoner)

Pull request description:

  This PR enables one more of the non-wallet functional tests (mempool_accept.py) to be run even with the Bitcoin Core wallet disabled by using the MiniWallet instead, as proposed in #20078.

  It also includes some other minor changes that came up while working on the replacement:
  * [commit 1/4] replace magic number 0xffffffff for a tx's nSequence with a new constant `SEQUENCE_FINAL`
  * [commit 2/4] create `CTransaction` instances with the current nVersion=2 by default, in order to use BIP68 for tests
  * [commit 3/4] support default `from_node` parameter for creating txs (this is a stripped down version of PR #24025)

ACKs for top commit:
  MarcoFalke:
    re-ACK aa8a65e4a8 📊

Tree-SHA512: 34cd085ea4147ad5bd3f3321c84204064ceb95f382664c7fe29062c1bbc79d9d9465c5e46d35e11c416f2f3cd46030c90a09b518c829c73ae40d060be5e4c9cb
2022-01-13 18:42:24 +01:00