Commit graph

32480 commits

Author SHA1 Message Date
stickies-v
54b39cfb34
Add release notes 2022-04-05 13:19:37 -04:00
stickies-v
f959fc0397
Update /<count>/ endpoints to use a '?count=' query parameter instead
In most RESTful APIs, path parameters are used to represent resources, and
query parameters are used to control how these resources are being filtered/sorted/...

The old /<count>/ functionality is kept alive to maintain backwards compatibility,
but new paths with query parameters are introduced and documented as the default
interface so future API methods don't break consistency by using query parameters.
2022-04-05 13:19:37 -04:00
stickies-v
a09497614e
Add GetQueryParameter helper function
Easily get the query parameter from the URI, with optional default value.
2022-03-10 12:01:54 +01:00
stickies-v
fff771ee86
Handle query string when parsing data format
URLs may contain a query string (prefixed with '?') and this should be ignored when parsing
the data format.

To facilitate testing this functionality, ParseDataFormat has been made non-static.
2022-03-10 12:01:53 +01:00
stickies-v
c1aad1b3b9
scripted-diff: rename RetFormat to RESTResponseFormat
As RetFormat is now exposed in a header, it is renamed to the more
understandable RESTResponseFormat
-BEGIN VERIFY SCRIPT-
s() { sed -i 's/RetFormat/RESTResponseFormat/g' $1; }
s src/rest.cpp
s src/rest.h
-END VERIFY SCRIPT-
2022-03-10 11:29:09 +01:00
stickies-v
9f1c54787c
Refactoring: move declarations to rest.h
This facilitates unit testing
2022-03-10 11:24:15 +01:00
MarcoFalke
219d728fcb
Merge bitcoin/bitcoin#24219: Fix implicit-integer-sign-change in bloom
fad84a2595 refactor: Fixup uint64_t-cast style in touched line (MarcoFalke)
fa041878de Fix implicit-integer-sign-change in bloom (MarcoFalke)

Pull request description:

  Signed values don't really make sense when using `std::vector::operator[]`.

  Fix that and remove the suppression.

ACKs for top commit:
  PastaPastaPasta:
    utACK fad84a2595
  theStack:
    Code-review ACK fad84a2595

Tree-SHA512: 7139dd9aa098c41e4af1b6e63dd80e71a92b0a98062d1676b01fe550ffa8e21a5f84a578afa7a536d70dad1b8a5017625e3a9e2dda6f864b452ec77b130ddf2a
2022-02-02 15:00:22 +01:00
MarcoFalke
a41976ab77
Merge bitcoin/bitcoin#24223: test: use MiniWallet for interface_rest.py
438e6f4c33 test: speedup interface_rest.py by whitelisting peers (immediate tx relay) (Sebastian Falbesoner)
11b9684dfd test: use MiniWallet for rest_interface.py (Sebastian Falbesoner)

Pull request description:

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

  Note that the original test sent funds from one node to another and checked node's balances, but the state of a node's wallet is not relevant to any of the REST endpoints, i.e. the replacement is quite stright-forward. In an additional commit, the test is further sped up by using the good ol' immediate tx relay trick (parameter `-whitelist=noban@127.0.0.1`).

ACKs for top commit:
  brunoerg:
    ACK 438e6f4c33

Tree-SHA512: eac351c5fb7e043c36c193d51545f20f563be9aaa04f3429a2bfb452ae4aa72294d2552800d6cac55c9a3ec2b4f30bcda2abcd74736dec3ed75e7d83c5af437f
2022-02-02 09:07:54 +01:00
Andrew Chow
02e1d8d06f
Merge bitcoin/bitcoin#24083: Revert "Add to spends only transcations from me"
3ee6d0788e test: add more wallet conflicts assertions (S3RK)
3b98bf9c43 Revert "Add to spends only transcations from me" (S3RK)

Pull request description:

  This reverts commit d04566415e from #22929.

  This commit was based on invalid assumption that `mapTxSpends` should contain only outgoing txs and broke wallet conflicts feature.

ACKs for top commit:
  achow101:
    ACK 3ee6d0788e

Tree-SHA512: bf5a77ced6bac57d5eb85771d9189c53e1edc295d179ed5a1bdce18e365794a9101b4cecf35387b27f67260db3b47f7214e7876e490494529b748cceeb95632d
2022-02-01 14:46:11 -05:00
MarcoFalke
133f73e86b
Merge bitcoin/bitcoin#24212: ci: Bump CentOS 8 image
fafc55a489 ci: Use dash when building depends in centos build (MarcoFalke)
fa33236e77 scripted-diff: Rename DOCKER_EXEC to CI_EXEC (MarcoFalke)
fa5457e64a ci: Bump CentOS 8 image (MarcoFalke)

Pull request description:

  CentOS 8 was just shut down:

  ```
  $ pob centos:8
  [root_e606059da4d9 /]# dnf update
  Failed to set locale, defaulting to C.UTF-8
  CentOS Linux 8 - AppStream
  Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
  ```

  Fix that by bumping the image.

ACKs for top commit:
  Sjors:
    utACK fafc55a with the caveat that I've never used CentOS.

Tree-SHA512: 741eb606c9f67cd218e41ce98460606d8594ff98148636c28ac20bae2809e3ee4a18c97aa3c849630f0a6ac30255c7423253b4309ae2d7cdd5c6624cc6836b95
2022-02-01 11:28:39 +01:00
MarcoFalke
fad84a2595
refactor: Fixup uint64_t-cast style in touched line 2022-02-01 11:19:18 +01:00
MarcoFalke
36f8e99d24
Merge bitcoin/bitcoin#24218: zmq: Fix implicit-integer-sign-change
fa2406a50a zmq: Fix implicit-integer-sign-change (MarcoFalke)

Pull request description:

  uint256::begin() returns unsigned data, so there is no reason to make it signed.

  Fix that and remove the sanitizer suppression.

ACKs for top commit:
  hebasto:
    ACK fa2406a50a
  PastaPastaPasta:
    utACK fa2406a50a, I have reviewed the code and think it makes sense

Tree-SHA512: 150ebcf3fdc3e0f60b6fd8e5fe638737b01e8a0863296bd545fb5ed17d33ab23b2ff94204996aa7b4617650b7383bd86ed2d2bf46746b410feae449de179a2bd
2022-02-01 10:18:53 +01:00
MarcoFalke
fafc55a489
ci: Use dash when building depends in centos build 2022-02-01 10:15:17 +01:00
MarcoFalke
fa33236e77
scripted-diff: Rename DOCKER_EXEC to CI_EXEC
-BEGIN VERIFY SCRIPT-
 sed -i "s/DOCKER_EXEC/CI_EXEC/g" $(git grep -l DOCKER_EXEC)
-END VERIFY SCRIPT-
2022-02-01 10:14:53 +01:00
MarcoFalke
fa5457e64a
ci: Bump CentOS 8 image 2022-02-01 10:13:25 +01:00
MarcoFalke
fcac16fff8
Merge bitcoin/bitcoin#24190: test: Fix sanitizer suppresions in streams_tests
faa630aa15 test: Fix sanitizer suppresions in streams_tests (MarcoFalke)

Pull request description:

  Two changes (that also make sense on their own) to remove the file-wide sanitizer suppression:

  * `FindByte` no longer takes a `char`, but an `uint8_t`, after commit 196b459920.
  * The `key` vector of unsigned chars can be removed and inlined as initializer-list. This avoids a bunch of verbose code like `clear()` and `push_back` of `char`s.

ACKs for top commit:
  PastaPastaPasta:
    utACK faa630aa15, I have reviewed the changes and agree it makes sense to merge

Tree-SHA512: 747b9d4676fad6d07f3955668639c93333625e69199ff4c499f01167de3875990d93db85e775a7f5b1b684575dceaec8aa000b4db15525fc47b699bac1c85e3d
2022-02-01 09:42:34 +01:00
Sebastian Falbesoner
438e6f4c33 test: speedup interface_rest.py by whitelisting peers (immediate tx relay)
By whitelisting the peers via -whitelist, the inventory is transmissioned
immediately rather than on average every 5 seconds, speeding up the test by at
least a factor of two:

before:
$ time ./interface_rest.py
...
0m14.82s real     0m01.44s user     0m01.19s system

with this commit:
$ time ./interface_rest.py
...
0m05.67s real     0m01.07s user     0m01.35s system
2022-01-31 22:56:34 +01:00
Sebastian Falbesoner
11b9684dfd test: use MiniWallet for rest_interface.py
This test can now be run even with the Bitcoin Core wallet disabled.
2022-01-31 22:47:40 +01:00
MarcoFalke
8f137e69ca
Merge bitcoin/bitcoin#24192: test: Fix feature_init intermittent issues
fa7b07571f test: Fix feature_init intermittent issues (MarcoFalke)
fa4595deb3 test: Remove random line number feature from feature_init.py (MarcoFalke)

Pull request description:

  The test doesn't work currently because the log might be finalized before `wait_for_debug_log` is started, in which case it will assume the log is empty and fail to detect any line.

  Fix this by calling `wait_for_debug_log` first. Fixes #24060.

  Also, remove the "random line number" part of the test, because it doesn't really test anything novel. `wait_for_debug_log` is inherently racy, so will randomly terminate at the exact point or later. So the randomization is already sufficiently covered.

ACKs for top commit:
  jamesob:
    ACK fa7b07571f
  mzumsande:
    Code Review ACK fa7b07571f

Tree-SHA512: f107a04926270a1d9ac8f53b6e5254566d1827ba7d27fd74f9ce909319f8794f8bd46da9c42256bf41b6df26c0bad8b9a0d54e4e148695189af09f31e3948330
2022-01-31 18:05:01 +01:00
MarcoFalke
fa041878de
Fix implicit-integer-sign-change in bloom 2022-01-31 17:23:54 +01:00
MarcoFalke
fa2406a50a
zmq: Fix implicit-integer-sign-change 2022-01-31 16:53:12 +01:00
MarcoFalke
0ff1391328
Merge bitcoin/bitcoin#24191: refactor: Make MessageBoxFlags enum underlying type unsigned
1111d33532 refactor: Make MessageBoxFlags enum underlying type unsigned (MarcoFalke)

Pull request description:

  All values in the enum are unsigned. Also, flags shouldn't be treated as signed types. So clarify the underlying type and remove a sanitizer suppression.

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

Tree-SHA512: 48b16c4a0ace1a1e4d351d6eadadbb1bc42aef7fd82e24e3ea50c62f2c04a552ed21027158d09aa97e630c8c7d732cb150c38065333d7c2accbae46593b7ed9f
2022-01-31 16:27:42 +01:00
MarcoFalke
ad05e68e17
Merge bitcoin/bitcoin#24103: Replace RecursiveMutex m_cs_chainstate with Mutex, and rename it
020acea99b refactor: replace RecursiveMutex m_chainstate_mutex with Mutex (w0xlt)
ddeefeef20 refactor: add negative TS annotations for `m_chainstate_mutex` (w0xlt)
1dfd31bc26 scripted-diff: rename m_cs_chainstate -> m_chainstate_mutex (w0xlt)

Pull request description:

  This PR is related to #19303 and gets rid of the `RecursiveMutex m_cs_chainstate`.

  `m_cs_chainstate` is only held in `ActivateBestChain()` and `InvalidateBlock()`.
  So apparently there is no recursion involved, so the `m_cs_chainstate` can be a non-recursive mutex.

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

Tree-SHA512: c7c16e727e326df3410514915ce753a2a5e1da78857ef965ef683e36251e1b73c9cced4cd5231b04dbe2be0ea14084f6731b4d7a4d9a8e086e982b985e37e4b4
2022-01-31 11:00:40 +01:00
MarcoFalke
fa7b07571f
test: Fix feature_init intermittent issues 2022-01-31 10:10:25 +01:00
MarcoFalke
fa4595deb3
test: Remove random line number feature from feature_init.py
This is needed for the next commit.

Also, it doesn't really test anything novel. wait_for_debug_log is
inherently racy, so will randomly terminate at the exact point or later.
So the randomization is already sufficiently covered by the existing
test.
2022-01-31 10:09:11 +01:00
MarcoFalke
5f4c07b799
Merge bitcoin/bitcoin#24136: Extract CTxIn::MAX_SEQUENCE_NONFINAL constant, rework BIP 65/68/112 docs
fa4339e4c1 Extract CTxIn::MAX_SEQUENCE_NONFINAL constant (MarcoFalke)

Pull request description:

  Extracting the constant makes it possible to attach documentation to it.

  Also, rework the docs for the other "sequence constants".

ACKs for top commit:
  w0xlt:
    reACK fa4339e for specifying the transaction version.
  darosior:
    re-ACK fa4339e4c1
  luke-jr:
    crACK fa4339e4c1

Tree-SHA512: 8d8f3dd5afb33eb5b72aa558e1e03de874c5ed02aa1084888e92ed86f3aaa5c725db45ded02e14cdfa67a92ac6774e97185b697f20a8ab63abbfcaa2fcd1fc6a
2022-01-31 09:40:33 +01:00
MarcoFalke
1111d33532
refactor: Make MessageBoxFlags enum underlying type unsigned 2022-01-31 09:27:12 +01:00
MarcoFalke
b25a752dfd
Merge bitcoin/bitcoin#24146: Avoid integer sanitizer warnings in chain.o
fa832103aa Avoid integer sanitizer warnings in chain.o (MarcoFalke)

Pull request description:

  The two changes make the code more self-documenting and also allow to remove 5 file-wide suppressions for the module

ACKs for top commit:
  PastaPastaPasta:
    utACK fa832103aa
  jonatack:
    ACK fa832103aa

Tree-SHA512: d32a06099c56eed9f69130a3209f989872acc593f849528acd7746ee6caa96688cc32de37e8e59ad5d25dcb8912e341f1a43e50642dadeff6ca7624d0873ad10
2022-01-31 09:23:54 +01:00
MarcoFalke
9237bdaac1
Merge bitcoin/bitcoin#24179: fuzz: Speed up script fuzz target
fa6842978d fuzz: Speed up script fuzz target (MarcoFalke)

Pull request description:

  Currently the script fuzz target takes the longest time (5000 seconds, aka 80 minutes, see https://cirrus-ci.com/task/5651378755338240?logs=ci#L4501).

  Fix this by making it twice as fast.

  Instead of running all possible combinations for all fuzz inputs, consume a bool and decide at runtime which path to take.

  I moved the new calls to the end to not invalidate existing fuzz inputs.

ACKs for top commit:
  prusnak:
    ACK fa6842978d

Tree-SHA512: 5e408255f96f9e92e472f4e8a8a0f8d8814bad444ac0ff7d5db5ed84a59a861135ffe5e04d81f479b0695cb17e4d7af005734959dd4aa9328bdc5acc98f36665
2022-01-31 08:58:23 +01:00
MarcoFalke
eacc0e87f8
Merge bitcoin/bitcoin#24168: Fix some race conditions in BanMan::DumpBanlist()
99a6b699cd Fix race condition for SetBannedSetDirty() calls (Hennadii Stepanov)
83c7646715 Avoid calling BanMan::SweepBanned() twice in a row (Hennadii Stepanov)
33bda6ab87 Fix data race condition in BanMan::DumpBanlist() (Hennadii Stepanov)
5e20e9ec38 Prevent possible concurrent CBanDB::Write() calls (Hennadii Stepanov)

Pull request description:

  This PR split from bitcoin/bitcoin#24097 with some additions. This makes the following switch from `RecursiveMutex` to `Mutex` a pure refactoring.

  See details in commit messages.

ACKs for top commit:
  w0xlt:
    reACK 99a6b69
  shaavan:
    ACK 99a6b699cd

Tree-SHA512: da4e7268c7bd3424491f446145f18af4ccfc804023d0a7fe70e1462baab550a5e44f9159f8b9f9c7820d2c6cb6447b63883616199e4d9d439ab9ab1b67c7201b
2022-01-31 08:55:35 +01:00
MarcoFalke
4efdbabd70
Merge bitcoin/bitcoin#24197: Replace lock with thread safety annotation in CBlockTreeDB::LoadBlockIndexGuts()
20276ca5d1 Replace lock with thread safety annotation in CBlockTreeDB::LoadBlockIndexGuts() (Jon Atack)

Pull request description:

  Following up on https://github.com/bitcoin/bitcoin/pull/22932#discussion_r794495535 by Marco Falke (good observation, thank you), we can replace a cs_main lock in `CBlockTreeDB::LoadBlockIndexGuts()` with a Clang thread safety annotation/assertion instead. The unlocked code is reverted to its original state before #22932.

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

Tree-SHA512: 2d91d1c962af0286d835d92a56396a27ea00e9d061b869eaff9421b448a083b0513828e1d4df7504396896057bf1e344e180a50271a5cfd1e1c7b6527155b2bb
2022-01-31 08:42:47 +01:00
MarcoFalke
af7b077973
Merge bitcoin/bitcoin#24203: doc: Fix typos pointed out by lint-spelling
58ccc88541 lint: add creat and ba into ignore-words for lint-spelling (brunoerg)
bad0e7f521 doc: Fix typos pointed out by lint-spelling (brunoerg)

Pull request description:

  Occuring -> occurring (random.h)
  Covert -> convert (chacha_poly_aead.cpp)
  Fix `nWe` false positive in blockchain.cpp (https://github.com/bitcoin/bitcoin/pull/24203#issuecomment-1025116962)

  Got it by linter, other ones are false positives.

ACKs for top commit:
  prusnak:
    ACK 58ccc88541

Tree-SHA512: b350d0e64968b96ead226da0be6aa4ca3f8e482ae401697867684ce8478e96b954124b3dea6dcd697aad4206f209f32f238d7cf0a0589075f24f5cf629c563f3
2022-01-31 08:18:51 +01:00
fanquake
5a51815275
Merge bitcoin/bitcoin#24129: build: Fix xargs warnings for Guix builds
c73415bc10 build: Fix xargs warnings for Guix builds (Hennadii Stepanov)

Pull request description:

  On master (e3ce019667) there are warnings in `./contrib/guix/guix-build` logs:
  ```
  xargs: warning: options --max-args and --replace/-I/-i are mutually exclusive, ignoring previous --max-args value
  ```

  This PR fixes such warnings.

ACKs for top commit:
  prusnak:
    utACK c73415b

Tree-SHA512: a7b55f59afbb19b78f795cea64acacf29903cfcd5fd7c37a771b073c1f2ff54555a26f3d00c1c73a8ef588396217ddf598e32b2ae961559042cc051b0aad162a
2022-01-31 14:07:43 +08:00
fanquake
32ee7675fa
Merge bitcoin/bitcoin#24111: build: force CRCCheck in Windows installer
b3ccf26df4 build: force CRCCheck in Windows installer (fanquake)

Pull request description:

  Otherwise a user can pass `/NCRC` on the command line and bypass the
  CRC check, meaning they could use a corrupted installer. I can't think of
  a reason why we'd want to allow the use of corrupted installers.

  [NSIS docs](https://nsis.sourceforge.io/Docs/Chapter4.html#acrccheck):
  > Specifies whether or not the installer will perform a CRC on itself before allowing an install. Note that if the user uses /NCRC on the command line when executing the installer, and you didn't specify 'force', the CRC will not occur, and the user will be allowed to install a (potentially) corrupted installer.

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

Tree-SHA512: 6b3c151bfd896dbf1a4af26114aec1721e4d4e6dad89eef796cd754c988b1bb03fd9a3f9889be3c754ff5b1cd7bf5bbfc126876c76038205c17807daff029319
2022-01-31 13:35:57 +08:00
brunoerg
58ccc88541 lint: add creat and ba into ignore-words for lint-spelling 2022-01-30 16:16:18 -03:00
brunoerg
bad0e7f521 doc: Fix typos pointed out by lint-spelling 2022-01-30 08:59:10 -03:00
Hennadii Stepanov
5b4b8f76f3
Merge bitcoin-core/gui#526: Add address relay/processed/rate-limited fields to peer details
9fbd1bb7fa gui: use available space to display "Last Transaction" in peer details (Jon Atack)
6cd132d380 gui: add "Addresses Rate-Limited" (m_addr_rate_limited) to peer details (Jon Atack)
19623d3182 gui: add "Addresses Processed" (m_addr_processed) to peer details (Jon Atack)
a465a66ef2 gui: add "Address Relay" (m_addr_relay_enabled) to peer details (Jon Atack)

Pull request description:

  This pull adds the following address fields in rpc getpeerinfo and cli -netinfo to the gui peers details:

  - Address Relay (Yes/No)
  - Addresses Processed (integer)
  - Addresses Rate-Limited (integer)

  and uses the additional horizontal space to display "Last Transaction" (instead of "Last Tx").

  ![Screenshot from 2022-01-21 00-05-49](https://user-images.githubusercontent.com/2415484/150436343-02abe635-8abe-4212-9ce5-522df17ca2b6.png)

ACKs for top commit:
  hebasto:
    ACK 9fbd1bb7fa, tested on Ubuntu 21.10 (Qt 5.15.2).
  w0xlt:
    reACK 9fbd1bb

Tree-SHA512: 76d414b82f432b7baf2cadcf2f52412a3af8ad78a93755bb82c65df5353dda4d2e2522428a36c8bb95316bf84b17f2485636c33ce5ae11566469671b5384d845
2022-01-28 20:42:42 +00:00
Jon Atack
20276ca5d1
Replace lock with thread safety annotation in CBlockTreeDB::LoadBlockIndexGuts() 2022-01-28 20:52:53 +01:00
Hennadii Stepanov
99a6b699cd
Fix race condition for SetBannedSetDirty() calls
Another thread can `SetBannedSetDirty(true)` while `CBanDB::Write()`
call being executed. The following `SetBannedSetDirty(false)`
effectively makes `m_is_dirty` flag value inconsistent with the actual
`m_banned` state. Such behavior can result in data loss, e.g., during
shutdown.
2022-01-28 19:27:25 +00:00
Hennadii Stepanov
83c7646715
Avoid calling BanMan::SweepBanned() twice in a row 2022-01-28 19:27:25 +00:00
Hennadii Stepanov
33bda6ab87
Fix data race condition in BanMan::DumpBanlist()
The m_is_dirty value being read in BannedSetIsDirty() can differ from
the value being set in SweepBanned(), i.e., be inconsistent with a
BanMan instance internal state.
2022-01-28 19:27:25 +00:00
Hennadii Stepanov
5e20e9ec38
Prevent possible concurrent CBanDB::Write() calls 2022-01-28 19:26:27 +00:00
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