Commit Graph

32491 Commits

Author SHA1 Message Date
MarcoFalke
1245c62fef
Merge bitcoin/bitcoin#24139: Avoid unsigned integer overflow in bitcoin-tx
faa75fa193 Avoid unsigned integer overflow in bitcoin-tx (MarcoFalke)

Pull request description:

  While `npos` means "largest unsigned value" and adding `1` to it yields `0`, it may be clearer to just assign `0` to it and only increment otherwise.

  This also allows to remove a file-wide suppression for `unsigned-integer-overflow`.

ACKs for top commit:
  hebasto:
    ACK faa75fa193, I have reviewed the code and it looks OK, I agree it can be merged.
  theStack:
    Code-review ACK faa75fa193

Tree-SHA512: c24436641e5d801341c948b812c7f711d5dff70efdf04af00fd3221f4b81d93f25608dddaa36230ba81ca7ab0d18bdd957095d4561e22621e4d69017934f0a16
2022-01-28 15:26:24 +01:00
MarcoFalke
faa630aa15
test: Fix sanitizer suppresions in streams_tests 2022-01-28 10:23:42 +01:00
MarcoFalke
d4e92d8436
Merge bitcoin/bitcoin#23508: Add getdeploymentinfo RPC
a380922891 Release notes for getdeploymentinfo rpc (Anthony Towns)
240cad09ba rpc: getdeploymentinfo: include signalling info (Anthony Towns)
376c0c6dae rpc: getdeploymentinfo: include block hash/height (Anthony Towns)
a7469bcd35 rpc: getdeploymentinfo: change stats to always refer to current period (Anthony Towns)
7f15c1841b rpc: getdeploymentinfo: allow specifying a blockhash other than tip (Anthony Towns)
fd826130a0 rpc: move softfork info from getblockchaininfo to getdeploymentinfo (Anthony Towns)

Pull request description:

  The aim of this PR is to improve the ability to monitor soft fork status. It first moves the softfork section from getblockchaininfo into a new RPC named getdeploymentinfo, which is then also able to query the status of forks at an arbitrary block rather than only at the tip. In addition, bip9 status is changed to indicate the status of the given block, rather than just for the next block, and an additional field is included to indicate whether each block in the signalling period signaled.

ACKs for top commit:
  laanwj:
    Code review and lightly tested ACK a380922891
  Sjors:
    tACK a380922891
  fjahr:
    tACK a380922891

Tree-SHA512: 7417d733b47629f229c5128586569909250481a3e94356c52fe67a03fd42cd81745246e384b98c4115fb61587714c879e4bc3e5f5c74407d9f8f6773472a33cb
2022-01-28 08:46:03 +01:00
fanquake
a4f7c41271
Merge bitcoin/bitcoin#21851: release: support cross-compiling for arm64-apple-darwin
edd70b52fc doc: add arm macOS depends platform triplet (jarolrod)
0628815e95 guix: add arm64-apple-darwin triplet (fanquake)
ca47f2e211 guix: use autoconf 2.71 (fanquake)
6fe55160dd contrib: support arm64 darwin in security checks (fanquake)
446e73cc0b build: use macOS 11 SDK (Xcode 12.2) (fanquake)

Pull request description:

  With a few minor changes, our macOS toolchain, and Guix, supports building for `arm64-apple-darwin` (Apple M1). Newer [`config.guess`](https://git.savannah.gnu.org/cgit/config.git/plain/config.guess) and [`config.sub`](https://git.savannah.gnu.org/cgit/config.git/plain/config.sub) are required (via autoconf 2.71), as support for recognising `arm64-apple-darwin` [was only recently added](https://git.savannah.gnu.org/cgit/config.git/commit/?id=2593751ef276497e312d7c4ce7fd049614c7bf80). A newer version of the macOS SDK (11.0+) is also required; I've taken this from Xcode 12.2.

  Guix Build:
  ```bash
  bash-5.1# find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
  c9c64c6252927c82d4a96eb2b1a13c557ac230afa3640a7f2feec87fabe2b7e5  guix-build-edd70b52fcd7/output/aarch64-linux-gnu/SHA256SUMS.part
  b57dd461ec6a0b22ce9614ab824bcbff4c3e6e935c22367aff9a718f46c3fd39  guix-build-edd70b52fcd7/output/aarch64-linux-gnu/bitcoin-edd70b52fcd7-aarch64-linux-gnu-debug.tar.gz
  66da9f57a6789108db3460d2b54a8bed68b7e147627404e51f66254d91500402  guix-build-edd70b52fcd7/output/aarch64-linux-gnu/bitcoin-edd70b52fcd7-aarch64-linux-gnu.tar.gz
  13213523984837fc66fe27cc4dac269f6ef554ec56316af92337f4c4845f6acf  guix-build-edd70b52fcd7/output/arm-linux-gnueabihf/SHA256SUMS.part
  e1a17b41c92879ccb6608a6a6f82aac22d999f10d798f40f96297d91ebd90d20  guix-build-edd70b52fcd7/output/arm-linux-gnueabihf/bitcoin-edd70b52fcd7-arm-linux-gnueabihf-debug.tar.gz
  6a6d54081c2dd8f9a44293275aea875587b5fa7cc31a30925fb5156bb1e55bf3  guix-build-edd70b52fcd7/output/arm-linux-gnueabihf/bitcoin-edd70b52fcd7-arm-linux-gnueabihf.tar.gz
  79f617a2f0a11e6a8fcf8058e05204a374ab5f689ccb15a2ff449ee2dd5e8216  guix-build-edd70b52fcd7/output/arm64-apple-darwin/SHA256SUMS.part
  6fb04a18b17812174ec35a6788dce5745d6c2dec558056dcfdd356b57d089b99  guix-build-edd70b52fcd7/output/arm64-apple-darwin/bitcoin-edd70b52fcd7-arm64-apple-darwin.tar.gz
  a67e415631bea940adab86adec9899593fa35e1773d4ac1149efd249adf89996  guix-build-edd70b52fcd7/output/arm64-apple-darwin/bitcoin-edd70b52fcd7-osx-unsigned.dmg
  2a41c273afb8bb621226de80302a7190eee057c2447d113999f40a9485430d44  guix-build-edd70b52fcd7/output/arm64-apple-darwin/bitcoin-edd70b52fcd7-osx-unsigned.tar.gz
  c8d9358471e1d72d56122ae6f53dc2a42ae0925628bf347acd1a3ae7110d8759  guix-build-edd70b52fcd7/output/dist-archive/bitcoin-edd70b52fcd7.tar.gz
  1985a4869307418ec2ee85f5f0ccfea0944eba0792318a8676ae213a9589ed97  guix-build-edd70b52fcd7/output/powerpc64-linux-gnu/SHA256SUMS.part
  6a1d3525011da84e24997c9ab39563b3597ae881b4d1af5a09a6e673cfc59808  guix-build-edd70b52fcd7/output/powerpc64-linux-gnu/bitcoin-edd70b52fcd7-powerpc64-linux-gnu-debug.tar.gz
  cda50c28b2920caef74de4b3e78fd4d81592d1aadc9758d1882f1cad16dc83ca  guix-build-edd70b52fcd7/output/powerpc64-linux-gnu/bitcoin-edd70b52fcd7-powerpc64-linux-gnu.tar.gz
  ca92936cf796543d13250f94175af772a9fc985e834017d6af2cfb36eea289e6  guix-build-edd70b52fcd7/output/powerpc64le-linux-gnu/SHA256SUMS.part
  64c46248065149a384c5710adeb4fd8e795ffee7d6441e4edb71468c6cf1478e  guix-build-edd70b52fcd7/output/powerpc64le-linux-gnu/bitcoin-edd70b52fcd7-powerpc64le-linux-gnu-debug.tar.gz
  bb9c3400a1dd88fa5fd26e8e22ba0f3a43263bdbb762233ed1670394d3d69ed1  guix-build-edd70b52fcd7/output/powerpc64le-linux-gnu/bitcoin-edd70b52fcd7-powerpc64le-linux-gnu.tar.gz
  926ef7a23ecdf02a6619f9dba0db814373c1a5105347e4c13b80a116910d1c8d  guix-build-edd70b52fcd7/output/riscv64-linux-gnu/SHA256SUMS.part
  cdf7ce78f206378a44122865150784c20bf1bec6943b48e35a41633c0f1f05ed  guix-build-edd70b52fcd7/output/riscv64-linux-gnu/bitcoin-edd70b52fcd7-riscv64-linux-gnu-debug.tar.gz
  026bbb6662f4074054457ce1678fc1d697bfbf87c80f1c3d5d560bcc18e3bea6  guix-build-edd70b52fcd7/output/riscv64-linux-gnu/bitcoin-edd70b52fcd7-riscv64-linux-gnu.tar.gz
  0190b93fc5d5202c6b252e51c34799fb153a284cc53b0e6f62d2521dc61866bd  guix-build-edd70b52fcd7/output/x86_64-apple-darwin/SHA256SUMS.part
  69aac1a962aeeec01c30015f79d93c57d68a484c3905b8a526f90e7e7382bc1b  guix-build-edd70b52fcd7/output/x86_64-apple-darwin/bitcoin-edd70b52fcd7-osx-unsigned.dmg
  ea37691f1df0389afedbb9eece45660dcb2ee867ffda1d26b244a471af2a6230  guix-build-edd70b52fcd7/output/x86_64-apple-darwin/bitcoin-edd70b52fcd7-osx-unsigned.tar.gz
  f56ff4035e3bc70c2cbb04f8a7f5ef23096088189e84fa172cec97f59336cf2b  guix-build-edd70b52fcd7/output/x86_64-apple-darwin/bitcoin-edd70b52fcd7-osx64.tar.gz
  a1c1bf47083c6f19bcc68761ea56bec666cfe128f4ba878a5655ae12874fe038  guix-build-edd70b52fcd7/output/x86_64-linux-gnu/SHA256SUMS.part
  cad26c66c764361b30c8204e7743dbb6c0e6dd1eb3af9418d77bd566e05e1470  guix-build-edd70b52fcd7/output/x86_64-linux-gnu/bitcoin-edd70b52fcd7-x86_64-linux-gnu-debug.tar.gz
  ed2b459a06d5bc0f895402323fc5cae543a387d0621a55214feb37513210324e  guix-build-edd70b52fcd7/output/x86_64-linux-gnu/bitcoin-edd70b52fcd7-x86_64-linux-gnu.tar.gz
  ```

ACKs for top commit:
  hebasto:
    ACK edd70b52fc, a Guix `bitcoin-edd70b52fcd7-osx-unsigned.dmg` tested on Mac mini (M1, 2020) + macOS Monterey 12.1 (21C52).

Tree-SHA512: 00c55e139ce60c89900ef9365c380beec9474d8a0459bb584fd966d17715344fcf95b208b7222f665a5e3989aed51d3161641d3737aa6122a41b0c9f0d35906d
2022-01-28 14:37:23 +08:00
laanwj
196b459920
Merge bitcoin/bitcoin#23438: refactor: Use spans of std::byte in serialize
fa5d2e678c Remove unused char serialize (MarcoFalke)
fa24493d63 Use spans of std::byte in serialize (MarcoFalke)
fa65bbf217 span: Add BytePtr helper (MarcoFalke)

Pull request description:

  This changes the serialize code (`.read()` and `.write()` functions) to take a `Span` instead of a pointer and size. This is a breaking change for the serialize interface, so at no additional cost we can also switch to `std::byte` (instead of using `char`).

  The benefits of using `Span`:
  * Less verbose and less fragile code when passing an already existing `Span`(-like) object to or from serialization

  The benefits of using `std::byte`:
  * `std::byte` can't accidentally be mistaken for an integer

  The goal here is to only change serialize to use spans of `std::byte`. If needed, `AsBytes`,  `MakeUCharSpan`, ... can be used (temporarily) to pass spans of the right type.

  Other changes that are included here:

  * [#22167](https://github.com/bitcoin/bitcoin/pull/22167) (refactor: Remove char serialize by MarcoFalke)
  * [#21906](https://github.com/bitcoin/bitcoin/pull/21906) (Preserve const in cast on CTransactionSignatureSerializer by promag)

ACKs for top commit:
  laanwj:
    Concept and code review ACK fa5d2e678c
  sipa:
    re-utACK fa5d2e678c

Tree-SHA512: 08ee9eced5fb777cedae593b11e33660bed9a3e1711a7451a87b835089a96c99ce0632918bb4666a4e859c4d020f88fb50f2dd734216b0c3d1a9a704967ece6f
2022-01-27 19:19:12 +01:00
MarcoFalke
fa6842978d
fuzz: Speed up script fuzz target 2022-01-27 15:38:59 +01:00
laanwj
cf5bb048e8
Merge bitcoin/bitcoin#22932: Add CBlockIndex lock annotations, guard nStatus/nFile/nDataPos/nUndoPos by cs_main
6ea5682784 Guard CBlockIndex::nStatus/nFile/nDataPos/nUndoPos by cs_main (Jon Atack)
5d59ae0ba8 Remove/inline ReadRawBlockFromDisk(block_data, pindex, message_start) (Hennadii Stepanov)
eaeeb88768 Require IsBlockPruned() to hold mutex cs_main (Jon Atack)
ca47b00577 Require CBlockIndex::IsValid() to hold cs_main (Vasil Dimov)
e9f3aa5f6a Require CBlockIndex::RaiseValidity() to hold cs_main (Vasil Dimov)
8ef457cb83 Require CBlockIndex::IsAssumedValid() to hold cs_main (Vasil Dimov)
572393448b Require CBlockIndex::GetUndoPos() to hold mutex cs_main (Jon Atack)
2e557ced28 Require WriteUndoDataForBlock() to hold mutex cs_main (Jon Atack)
6fd4341c10 Require CBlockIndex::GetBlockPos() to hold mutex cs_main (Jon Atack)

Pull request description:

  Issues:

  - `CBlockIndex` member functions `GetBlockPos()`, `GetUndoPos()`, `IsAssumedValid()`, `RaiseValidity()`, and `IsValid()` and block storage functions `WriteUndoDataForBlock()` and `IsBlockPruned()` are missing thread safety lock annotations to help ensure that they are called with mutex cs_main to avoid bugs like #22895. Doing this also enables the next step:

  - `CBlockIndex::nStatus` may be racy, i.e. potentially accessed by multiple threads, see #17161. A solution is to guard it by cs_main, along with fellow data members `nFile`, `nDataPos` and `nUndoPos`.

  This pull:

  - adds thread safety lock annotations for the functions listed above
  - guards `CBlockIndex::nStatus`, `nFile`, `nDataPos` and `nUndoPos` by cs_main

  How to review and test:
  - debug build with clang and verify there are no `-Wthread-safety-analysis` warnings
  - review the code to verify each annotation or lock is necessary and sensible, or if any are missing
  - look for whether taking a lock can be replaced by a lock annotation instead
  - for more information about Clang thread safety analysis, see
      - https://clang.llvm.org/docs/ThreadSafetyAnalysis.html
      - https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#lockingmutex-usage-notes
      - https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#threads-and-synchronization

  Mitigates/potentially closes #17161.

ACKs for top commit:
  laanwj:
    Code review ACK 6ea5682784

Tree-SHA512: 3ebf429c8623c51f944a7245a2e48d2aa088dec4c4914b40aa6049e89856c1ee8586f6e2e3b65195190566637a33004468b51a781e61a082248748015167569b
2022-01-27 10:57:33 +01:00
fanquake
d87a37a4ab
Merge bitcoin/bitcoin#24167: fs: consistently use fsbridge:: for ifstream / ofstream
5e8975e269 fs: consistently use fsbridge for fopen() (fanquake)
486261dfcb fs: add missing <cassert> include (fanquake)
21f781ad79 fs: consistently use fsbridge for {i,o}fstream (fanquake)

Pull request description:

  These changes are part of #20744, but are also ok to do now, and reduce the diff in that PR. See commit messages for details. Revived from #23857.

ACKs for top commit:
  laanwj:
    Code review ACK 5e8975e269
  MarcoFalke:
    ACK 5e8975e269 🏕

Tree-SHA512: ee2dc857ce2479b39b65615e689f934b962e580299b0e7a0c6361633402b0d61e6e4479f41f6480e2c46101264d93f330b8f7b57e56df95a7f77e046a4e44697
2022-01-27 16:57:40 +08:00
fanquake
4241c193d4
Merge bitcoin/bitcoin#24134: build: Fix zeromq package when cross-compiling
f13e642c83 build: Disable valgrind when building zeromq package in depends (Hennadii Stepanov)
b970f03bea build: Disable libbsd when building zeromq package in depends (Hennadii Stepanov)
77899991b1 build: Update netbsd_kevent_void.patch (Hennadii Stepanov)

Pull request description:

  Since v4.3.3 (068385c951) `libzmq` uses `libbsd` by default.

  This PR disables `libbsd` explicitly, as it's not a part of our depends. Zeromq will fallback to its internal `strlcpy` implementation.

  Otherwise, on systems with installed `libbsd-dev` package the `zeromq` package build system erroneously detects `libbsd` package from the host system:

  ```diff
  --- a/libzmq.pc
  +++ b/libzmq.pc
  @@ -8,5 +8,5 @@
   Version: 4.3.4
   Libs: -L${libdir} -lzmq
   Libs.private:  -lpthread
  -Requires.private:
  +Requires.private:  libbsd
   Cflags: -I${includedir}
  ```

  This causes the `configure` fails to detect the `zeromq` package:
  ```
  configure: WARNING: libzmq version 4.x or greater not found, disabling
  ```

  ---

  Other minor improvements:
  - fixed `netbsd_kevent_void.patch` offset
  - disabled valgrind as it's used in unit tests which we do not run:
  ```diff
  --- a/zmq-configure-output
  +++ b/zmq-configure-output
  @@ -119,11 +119,6 @@
   checking whether the g++ -m64 linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
   checking dynamic linker characteristics... (cached) GNU/Linux ld.so
   checking how to hardcode library paths into programs... immediate
  -checking for valgrind... valgrind
  -checking for Valgrind tool memcheck... memcheck
  -checking for Valgrind tool helgrind... helgrind
  -checking for Valgrind tool drd... drd
  -checking for Valgrind tool exp-sgcheck... exp-sgcheck
   checking linker version script flag... --version-script
   checking if version scripts can use complex wildcards... yes
   checking for working posix_memalign... yes
  ```

ACKs for top commit:
  fanquake:
    ACK f13e642c83

Tree-SHA512: d4c86d4a841eb6e7c32157e84972243072f905496c2a4c14ec6f6ab4216df6695cbf29baa2233ce27eaede35d1e250ad2f9975b16f570d01509f0c5da4597cad
2022-01-27 10:44:48 +08:00
Andrew Chow
3d223712d3
Merge bitcoin/bitcoin#16795: rpc: have raw transaction decoding infer output descriptors
6498ba151b transaction decoding infer output descriptors (Gregory Sanders)

Pull request description:

  Following discussion in #16725 this is complementary data to expose. All outputs are inferred.

ACKs for top commit:
  achow101:
    ACK 6498ba151b
  meshcollider:
    utACK 6498ba151b

Tree-SHA512: 36664117ddbe46d5fdde7ed6541ef2c9d8dfb7a3636b97f363bf1c325096fe00d9d2acea2d1917ea19fdb82f1ea296c12e440c5c703d6a9bfc1a02fba028bcd8
2022-01-26 17:52:51 -05:00
MarcoFalke
fa4339e4c1
Extract CTxIn::MAX_SEQUENCE_NONFINAL constant 2022-01-26 15:10:44 +01:00
fanquake
5e8975e269
fs: consistently use fsbridge for fopen() 2022-01-26 22:08:29 +08:00
fanquake
486261dfcb
fs: add missing <cassert> include
This is needed to prevent compilation failures once boost is removed,
however is still correct to include now, and reduces the diff in #20744.

<string> is extracted from the defines because it is used for Windows
and non-Windows code, i.e get_filesystem_error_message().
2022-01-26 22:08:29 +08:00
fanquake
21f781ad79
fs: consistently use fsbridge for {i,o}fstream
Part of #20744, but this can be done now, and will simplify the diff.
2022-01-26 22:08:19 +08:00
fanquake
e3699b71c4
Merge bitcoin/bitcoin#24155: doc: Fix rpc docs
fac8caaa62 doc: Fix rpc docs (MarcoFalke)

Pull request description:

  Broken in commit 39d9bbe4ac.

  The fix removes the "type" `OBJ_EMPTY` added in commit 8d1a3e6498, which isn't really a separate type and instead runs a check on `OBJ` whether it is empty or not.

ACKs for top commit:
  Sjors:
    tACK fac8caaa62

Tree-SHA512: dd978fe526a45095800249204afd26a239078e83b15124a5756ac078c473a677a3084b8f54e34d6dd5580abef7275c875a14bc9eb20d8feab066dfb0f0932967
2022-01-26 21:20:02 +08:00
Jon Atack
bcc5676f16
p2p, contrib: update i2p hardcoded seeds
Remove unresponsive seeds, and add one that has been up for the past half year.
2022-01-26 12:58:23 +01:00
Jon Atack
e5332425fc
p2p, contrib: add cjdns hardcoded seeds 2022-01-26 12:58:12 +01:00
MarcoFalke
2935bd9d67
Merge bitcoin/bitcoin#24113: test, bugfix: fix intermittent failure in getrawtransaction_tests
449dffc610 test, bugfix: fix intermittent failure in getrawtransaction_tests (Jon Atack)

Pull request description:

  Easiest to review with `colorMoved = dimmed-zebra` and `colorMovedWs = allow-indentation-change`.

  Resolves #23991

Top commit has no ACKs.

Tree-SHA512: a50c597857e45c52dae1b6fc5988ea077c09f2b32ffe3605f0c64bd780f5dd2635755cb26c4981233bf925c5ea9f7310163349a549239dc85657558f253ffb7b
2022-01-26 11:04:17 +01:00
jarolrod
edd70b52fc
doc: add arm macOS depends platform triplet 2022-01-26 17:32:46 +08:00
fanquake
0628815e95
guix: add arm64-apple-darwin triplet 2022-01-26 17:32:46 +08:00
fanquake
ca47f2e211
guix: use autoconf 2.71
This allows for building with newer targets, like arm64-apple-darwin, due to
having a newer bundled config.guess and config.sub.
2022-01-26 17:32:46 +08:00
fanquake
6fe55160dd
contrib: support arm64 darwin in security checks 2022-01-26 17:32:10 +08:00
fanquake
446e73cc0b
build: use macOS 11 SDK (Xcode 12.2)
This should be sufficient to support building for Apple ARM when
cross-compiling.
2022-01-26 17:28:16 +08:00
MarcoFalke
dd405add6e
Merge bitcoin/bitcoin#24154: test: add functional test for -maxtipage parameter
75656adfd2 test: add functional test for `-maxtipage` parameter (Sebastian Falbesoner)

Pull request description:

  This PR adds a missing test for the `-maxtipage` parameter which controls what is the allowed maximum tip age for leaving IBD:
  792d0d8d51/src/init.cpp (L540)

  Relevant code path in the `CChainState::IsInitialBlockDownload` method:
  792d0d8d51/src/validation.cpp (L1479-L1480)

  The test is pretty simple and should be self-explanatory.

ACKs for top commit:
  MarcoFalke:
    review ACK 75656adfd2

Tree-SHA512: 0a10dca13cb18c29e64fc8412f4c8f2bcaff1bab8645bd85266c242ba88ce036a150c03cbbe9810c3bb44649810af0aa9cb3584dbae886a7bdb16b72150d08de
2022-01-26 07:36:07 +01:00
fanquake
01beb46f8d
Merge bitcoin/bitcoin#24153: test: remove unused sanitizer suppressions
fa3bdbd37b test: remove unused sanitizer suppressions (MarcoFalke)

Pull request description:

  Looks like those are not needed (anymore)

ACKs for top commit:
  fanquake:
    ACK fa3bdbd37b

Tree-SHA512: 4bedb6363aba8ea7763291ee0cd074e6bfd77e691bb32999c3959393864dc396bacba1eced2b10d9d600b66e8b83b91f7bc6692331dbd113bbaa87e72d11e2e8
2022-01-26 10:13:57 +08:00
Gregory Sanders
6498ba151b transaction decoding infer output descriptors 2022-01-26 09:56:51 +08:00
Andrew Chow
e30b6ea194
Merge bitcoin/bitcoin#24067: wallet: Actually treat (un)confirmed txs as (un)confirmed
fac8165443 Remove unused checkFinalTx (MarcoFalke)
fa272eab44 wallet: Avoid dropping confirmed coins (MarcoFalke)
888841ea8d interfaces: Remove unused is_final (MarcoFalke)
dddd05e7a3 qt: Treat unconfirmed txs as unconfirmed (MarcoFalke)

Pull request description:

  The wallet has several issues:

  ## Unconfirmed txs in the GUI

  The GUI clumsily attempts to guess if unconfirmed txs are locked until a future time. This is currently based on the locktime only, not nSequence, thus wrong. Fix this by removing the clumsy code and treat all unconfirmed txs as unconfirmed. The GUI already prints whether a tx is in the mempool, in which case the user knows that the tx wasn't locked until a future time. If the tx is not in the mempool, it might be better to report the exact reject reason from the mempool instead of using incorrect heuristics.

  ## Confirmed txs in the wallet

  The wallet drops coins that it incorrectly assumes to be locked until a future time, even if they are already confirmed in the chain. This is because the wallet is using the wrong time (adjusted network time) instead of MTP, due to the `-1` default argument of `CheckFinalTx`.

  The issues are fixed in separate commits and there is even a test.

ACKs for top commit:
  achow101:
    ACK fac8165443
  prayank23:
    reACK fac8165443
  glozow:
    code review ACK fac8165443, I understand now how this fixes both issues.

Tree-SHA512: 210afb855f4c6d903fee49eba6b1a9735d699cf0168b669eabb38178e53b3a522258b7cc669f52489c6cd3e38bf358afde12eef3ba2e2f2ffaeb06b8f652ccd0
2022-01-25 16:17:51 -05:00
Jon Atack
6ea5682784
Guard CBlockIndex::nStatus/nFile/nDataPos/nUndoPos by cs_main
Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
2022-01-25 20:46:52 +01:00
Hennadii Stepanov
5d59ae0ba8
Remove/inline ReadRawBlockFromDisk(block_data, pindex, message_start) 2022-01-25 20:43:37 +01:00
Jon Atack
eaeeb88768
Require IsBlockPruned() to hold mutex cs_main
Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
2022-01-25 20:43:34 +01:00
Vasil Dimov
ca47b00577
Require CBlockIndex::IsValid() to hold cs_main 2022-01-25 20:43:31 +01:00
Vasil Dimov
e9f3aa5f6a
Require CBlockIndex::RaiseValidity() to hold cs_main 2022-01-25 20:43:28 +01:00
Vasil Dimov
8ef457cb83
Require CBlockIndex::IsAssumedValid() to hold cs_main 2022-01-25 20:43:25 +01:00
Jon Atack
572393448b
Require CBlockIndex::GetUndoPos() to hold mutex cs_main 2022-01-25 20:43:22 +01:00
Jon Atack
2e557ced28
Require WriteUndoDataForBlock() to hold mutex cs_main
Mutex cs_main is already held by the caller of WriteUndoDataForBlock().
This change is needed to require CBlockIndex::GetUndoPos() to hold
cs_main and CBlockIndex::nStatus to be guarded by cs_main in the
following commits without adding 2 unnecessary cs_main locks to
WriteUndoDataForBlock().
2022-01-25 20:43:19 +01:00
Jon Atack
6fd4341c10
Require CBlockIndex::GetBlockPos() to hold mutex cs_main 2022-01-25 20:43:12 +01:00
MarcoFalke
fac8caaa62
doc: Fix rpc docs
Broken in commit 39d9bbe4ac
2022-01-25 20:05:44 +01:00
MarcoFalke
39d9bbe4ac
Merge bitcoin/bitcoin#23706: rpc: getblockfrompeer followups
923312fbf6 rpc: use peer_id, block_hash for FetchBlock (Sjors Provoost)
34d5399211 rpc: more detailed errors for getblockfrompeer (Sjors Provoost)
60243cac72 rpc: turn already downloaded into error in getblockfrompeer (Sjors Provoost)
809d66bb65 rpc: clarify getblockfrompeer behavior when called multiple times (Sjors Provoost)
0e3d7c5ee1 refactor: drop redundant hash argument from FetchBlock (Sjors Provoost)
8d1a3e6498 rpc: allow empty JSON object result (Sjors Provoost)
bfbf91d0b2 test: fancier Python for getblockfrompeer (Sjors Provoost)

Pull request description:

  Followups from #20295.

ACKs for top commit:
  jonatack:
    ACK 923312fbf6 📦
  fjahr:
    tested ACK 923312fbf6

Tree-SHA512: da9eca76e302e249409c9d7f0d16cca668ed981e2ab6ca2d1743dad0d830b94b1bc5ffb9028a00764b863201945c273cc8f4409a4c9ca3817830007dffa2bc20
2022-01-25 18:48:41 +01:00
laanwj
b94d0c7af1
Merge bitcoin/bitcoin#23201: wallet: Allow users to specify input weights when funding a transaction
3866272c45 tests: Test specifying input weights (Andrew Chow)
6fa762a372 rpc, wallet: Allow users to specify input weights (Andrew Chow)
808068e90e wallet: Allow user specified input size to override (Andrew Chow)
4060c50d7e wallet: add input weights to CCoinControl (Andrew Chow)

Pull request description:

  When funding a transaction with external inputs, instead of providing solving data, a user may want to just provide the maximum signed size of that input. This is particularly useful in cases where the input is nonstandard as our dummy signer is unable to handle those inputs.

  The input weight can be provided to any input regardless of whether it belongs to the wallet and the provided weight will always be used regardless of any calculated input weight. This allows the user to override the calculated input weight which may overestimate in some circumstances due to missing information (e.g. if the private key is not known, a maximum size signature will be used, but the actual signer may be doing additional work which reduces the size of the signature).

  For `send` and `walletcreatefundedpsbt`, the input weight is specified in a `weight` field in an input object. For `fundrawtransaction`,  a new `input_weights` field is added to the `options` object. This is an array of objects consisting of a txid, vout, and weight.

  Closes #23187

ACKs for top commit:
  instagibbs:
    reACK 3866272c45
  glozow:
    reACK 3866272 via range-diff
  t-bast:
    ACK 3866272c45

Tree-SHA512: 2c8b471ee537c62a51389b7c4e86b5ac1c3a223b444195042be8117b3c83e29c0619463610b950cbbd1648d3ed01ecc5bb0b3c4f39640680da9157763b9b9f9f
2022-01-25 17:51:05 +01:00
Sebastian Falbesoner
75656adfd2 test: add functional test for -maxtipage parameter 2022-01-25 16:20:00 +01:00
MarcoFalke
fa3bdbd37b
test: remove unused sanitizer suppressions 2022-01-25 16:15:53 +01:00
laanwj
792d0d8d51
Merge bitcoin/bitcoin#23839: Linux: build with and test for control flow instrumentation on x86_64
5a8f907c93 scripts: add CONTROL_FLOW to ELF security checks (fanquake)
e13f8f775d build: build x86_64 Linux Boost with -fcf-protection=full (fanquake)
6ca5efa8ed script rename control flow check to MACHO specific (fanquake)

Pull request description:

  Closes #21888.

  TODO:
  * Duplication in security-check-tests

  Guix build:
  ```bash
  bash-5.1# find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
  8025e2e6859247eaf865a4a5009d0a39570ec5e8ab51739fa4da0d8ee4ab2117  guix-build-5a8f907c93f1/output/aarch64-linux-gnu/SHA256SUMS.part
  75576482994493262dbf7d3567b0450c0804bdc75c186d6b4c6a856bd0d8f0a3  guix-build-5a8f907c93f1/output/aarch64-linux-gnu/bitcoin-5a8f907c93f1-aarch64-linux-gnu-debug.tar.gz
  7cb89c9327cc540859334b597c041a2250156e3e83ce2aa7d16177376056302f  guix-build-5a8f907c93f1/output/aarch64-linux-gnu/bitcoin-5a8f907c93f1-aarch64-linux-gnu.tar.gz
  e264053e4c7a5d65340dd7bbd2c664bcd596292ab80f00a0bf0026bfe0c480bc  guix-build-5a8f907c93f1/output/arm-linux-gnueabihf/SHA256SUMS.part
  6c3ee9b3c0c4583620301b183226678f1618605dd07dbed0bbdf7d06d3591314  guix-build-5a8f907c93f1/output/arm-linux-gnueabihf/bitcoin-5a8f907c93f1-arm-linux-gnueabihf-debug.tar.gz
  f217cb8d8e233a8dbdbfde7dabf12c5d867d7de53e8c652b8ed1d4a55da82fd9  guix-build-5a8f907c93f1/output/arm-linux-gnueabihf/bitcoin-5a8f907c93f1-arm-linux-gnueabihf.tar.gz
  48b4b2a1b52b3098f4e92c11cb60f1e5e9696a2a960560cd6adea72277eaa4a4  guix-build-5a8f907c93f1/output/dist-archive/bitcoin-5a8f907c93f1.tar.gz
  40832db2446e129879caa9fbc9d682c53069876dbb2e0d4d76592e5dcb40bb12  guix-build-5a8f907c93f1/output/powerpc64-linux-gnu/SHA256SUMS.part
  26fdfa9b7b77d5db415ef34054cf6f6d020a5dab73239db6dd05539f654bc5d5  guix-build-5a8f907c93f1/output/powerpc64-linux-gnu/bitcoin-5a8f907c93f1-powerpc64-linux-gnu-debug.tar.gz
  3adbdb9d3eb1cb5f9adc38b29450054f286bd6d74cef8619adaee89494853605  guix-build-5a8f907c93f1/output/powerpc64-linux-gnu/bitcoin-5a8f907c93f1-powerpc64-linux-gnu.tar.gz
  8ec2baf82483a698350bfdabf530cd9b5241690c916f597c746210e95ac451de  guix-build-5a8f907c93f1/output/powerpc64le-linux-gnu/SHA256SUMS.part
  1797e75e1f66ec9068fa4e57e0108960475e863f8f054fbe854358b1f995c4df  guix-build-5a8f907c93f1/output/powerpc64le-linux-gnu/bitcoin-5a8f907c93f1-powerpc64le-linux-gnu-debug.tar.gz
  448bd289ef26c777a1fc4498e7ba7fb17d0f6a932dcac91b2f89cbba63704bb8  guix-build-5a8f907c93f1/output/powerpc64le-linux-gnu/bitcoin-5a8f907c93f1-powerpc64le-linux-gnu.tar.gz
  a23ee91eeae515c2a6a31eb25d659fab833839aaafa4676ccee364bdad2a468c  guix-build-5a8f907c93f1/output/riscv64-linux-gnu/SHA256SUMS.part
  82df1b6d5020d0af8268ecc8e823f752f20dec308277763b2dd675804dfa4bbd  guix-build-5a8f907c93f1/output/riscv64-linux-gnu/bitcoin-5a8f907c93f1-riscv64-linux-gnu-debug.tar.gz
  09a6098ce83896a6ee6d5c8aff12eaca51595bd724c8e0b2a6f90b6410dc168c  guix-build-5a8f907c93f1/output/riscv64-linux-gnu/bitcoin-5a8f907c93f1-riscv64-linux-gnu.tar.gz
  4fac2951f80eaa2bd1747a263be6be1b76282cac5062f7d86db631a2fb80f8db  guix-build-5a8f907c93f1/output/x86_64-apple-darwin/SHA256SUMS.part
  3392f417b09efca5916c384f0b2d0c177a72ec4921399c62e84484f0054cc8c4  guix-build-5a8f907c93f1/output/x86_64-apple-darwin/bitcoin-5a8f907c93f1-osx-unsigned.dmg
  bfb4f8ade6107996ec4bc9efdb53959151b8fb19b6790c34472fe218dd02383d  guix-build-5a8f907c93f1/output/x86_64-apple-darwin/bitcoin-5a8f907c93f1-osx-unsigned.tar.gz
  4de92e149bad46fc863efb3b650753d194aad96be991d020e0b859452cf27457  guix-build-5a8f907c93f1/output/x86_64-apple-darwin/bitcoin-5a8f907c93f1-osx64.tar.gz
  9329549a2f275a59e329afc8744ff8cbc297f3042e0ad03b47626805c7aae2e8  guix-build-5a8f907c93f1/output/x86_64-linux-gnu/SHA256SUMS.part
  d87deb1eca8a1d3780f02edde78350d27f700e13c7ff444be0bfb34e7369904a  guix-build-5a8f907c93f1/output/x86_64-linux-gnu/bitcoin-5a8f907c93f1-x86_64-linux-gnu-debug.tar.gz
  76f3bc2fad010d9373e854d941e8205b68fa6c9a8ecaff34c4978ae3ae76c806  guix-build-5a8f907c93f1/output/x86_64-linux-gnu/bitcoin-5a8f907c93f1-x86_64-linux-gnu.tar.gz
  2948631081c4bd475529da2b7bc2b32b5aa2e44de46dfdaa6cf9432b3c9fe869  guix-build-5a8f907c93f1/output/x86_64-w64-mingw32/SHA256SUMS.part
  c5d56fac163b73c00e9745aa7b0f9a0bd9fcac7517e39b677869b6e76faf7218  guix-build-5a8f907c93f1/output/x86_64-w64-mingw32/bitcoin-5a8f907c93f1-win-unsigned.tar.gz
  f12c7cd72511544c67f4934981c090cee0d9c17e931c059edbbbef6e843dd651  guix-build-5a8f907c93f1/output/x86_64-w64-mingw32/bitcoin-5a8f907c93f1-win64-debug.zip
  eb952cc4554f92ba6787353f4305d7cbcb1c6dafc4a3867b3088106252a573b8  guix-build-5a8f907c93f1/output/x86_64-w64-mingw32/bitcoin-5a8f907c93f1-win64-setup-unsigned.exe
  7bd2b071f1cdf9410535e6a10dd1da519f942bd2c1e47ed52c5b8c4f977e8f27  guix-build-5a8f907c93f1/output/x86_64-w64-mingw32/bitcoin-5a8f907c93f1-win64.zip
  ```

ACKs for top commit:
  laanwj:
    Code review ACK 5a8f907c93
  hebasto:
    ACK 5a8f907c93, I have reviewed the code and it looks OK, I agree it can be merged.

Tree-SHA512: 75702ac01175ccf08e73b5c3bce266cee9dd15ccf8fb38d46108cfada156de9a8c18e27d996f9343ae33f7a75a6904d335cbe25256d90af1f4ccbe72ce1788bb
2022-01-25 16:01:21 +01:00
Hennadii Stepanov
f13e642c83
build: Disable valgrind when building zeromq package in depends
We are not running unit tests, therefore it is not required.
2022-01-25 14:44:33 +02:00
Hennadii Stepanov
b970f03bea
build: Disable libbsd when building zeromq package in depends
Since v4.3.3 (068385c951c0608edec6264d55ba9c4c923acccc) libbsd is used
by default. As we have no libbsd package in our depends, disable it
explicitly. Zeromq will fallback to its internal strlcpy implementation.
2022-01-25 14:36:05 +02:00
Hennadii Stepanov
77899991b1
build: Update netbsd_kevent_void.patch
This change fixes "Hunk #1 succeeded at 307 (offset -1 lines)."
2022-01-25 14:36:05 +02:00
MarcoFalke
fa832103aa
Avoid integer sanitizer warnings in chain.o 2022-01-25 10:49:46 +01:00
MarcoFalke
fac8165443
Remove unused checkFinalTx 2022-01-25 10:16:06 +01:00
MarcoFalke
fa272eab44 wallet: Avoid dropping confirmed coins 2022-01-25 10:15:12 +01:00
MarcoFalke
bd482b3ffe
Merge bitcoin/bitcoin#24105: Optimize CHECKSIGADD Script Validation
cfa575266b Optimize CHECKSIGADD Script Validation (Jeremy Rubin)

Pull request description:

  This is a mild validation improvement that improves performance by caching some signature data when you have a Taproot script fragment that uses CHECKSIGADD Multisignatures with sighash single. In some basic testing I showed this to have about a 0.6% speedup during block validation for a block with a lot of CHECKSIGADDs, but that was with the entirety of block validation so the specific impact on the script interpreter performance should be a bit more once you subtract things like coin fetching. If desired I can produce a more specific/sharable bench for this, the code I used to test was just monkey patching the existing taproot tests since generating valid spends is kinda tricky. But it's sort of an obvious win so I'm not sure it needs a rigorous bench, but I will tinker on one of those while the code is being reviewed for correctness.

  The overhead of this approach is that:

  1. ScriptExecutionData is no longer const
  2. around 32 bytes of extra stack space
  3. zero extra hashing since we only cache on first use

ACKs for top commit:
  sipa:
    utACK cfa575266b
  MarcoFalke:
    review ACK cfa575266b
  jonatack:
    ACK cfa575266b
  theStack:
    Code-review ACK cfa575266b

Tree-SHA512: d5938773724bb9c97b6fd623ef7efdf7f522af52dc0903ecb88c38a518b628d7915b7eae6a774f7be653dc6bcd92e9abc4dd5e8b11f3a995e01e0102d2113d09
2022-01-25 09:14:48 +01:00
fanquake
69ef0a107f
Merge bitcoin/bitcoin#24130: doc: Update the used Qt version
d67fc786d9 doc: Update the used Qt version (Hennadii Stepanov)

Pull request description:

  Missed in bitcoin/bitcoin#23489.

ACKs for top commit:
  w0xlt:
    ACK d67fc78
  shaavan:
    ACK d67fc786d9
  prusnak:
    ACK d67fc78
  promag:
    ACK d67fc786d9.

Tree-SHA512: f15d83dca1c7dcdb9bd862358cd0e9a2740d88b8eaa0de8223210c9ce89e7526c6f98908bf26d512ff9271d6d59fda1d0c7ac97fcd7ef4b8b0c06d24b9d62f33
2022-01-25 11:41:06 +08:00