Commit graph

32300 commits

Author SHA1 Message Date
Pieter Wuille
314195c8be Remove unnecessary cast in CKey::SignSchnorr 2021-12-15 09:20:26 -05:00
Pieter Wuille
a1f76cdb22 Remove --disable-openssl-tests for libsecp256k1 configure 2021-12-15 09:20:12 -05:00
Pieter Wuille
dff0596fa0 Update secp256k1 subtree to latest upstream master 2021-12-15 09:19:50 -05:00
Pieter Wuille
86dbc4d075 Squashed 'src/secp256k1/' changes from be8d9c262f..0559fc6e41
0559fc6e41 Merge bitcoin-core/secp256k1#988: Make signing table fully static
7dfceceea6 build: Remove #undef hack for ASM in the precomputation programs
bb36fe9be0 ci: Test `make precomp`
d94a37a20c build: Remove CC_FOR_BUILD stuff
ad63bb4c29 build: Prebuild and distribute ecmult_gen table
ac49361ed0 prealloc: Get rid of manual memory management for prealloc contexts
6573c08f65 ecmult_gen: Tidy precomputed file and save space
5eba83f17c ecmult_gen: Precompute tables for all values of ECMULT_GEN_PREC_BITS
5d0dbef018 Merge bitcoin-core/secp256k1#942: Verify that secp256k1_ge_set_gej_zinv does not operate on infinity.
486205aa68 Merge bitcoin-core/secp256k1#920: Test all ecmult functions with many j*2^i combinations
fdb33dd122 refactor: Make PREC_BITS a parameter of ecmult_gen_build_prec_table
5eb519e1f6 ci: reduce TEST_ITERS in memcheck run
e2cf77328a Test ecmult functions for all i*2^j for j=0..255 and odd i=1..255.
61ae37c612 Merge bitcoin-core/secp256k1#1022: build: Windows DLL additions
4f01840b82 Merge bitcoin-core/secp256k1#1027: build: Add a check that Valgrind actually supports a host platform
6ad908aa00 Merge bitcoin-core/secp256k1#1008: bench.c: add `--help` option and ci: move env variables
592661c22f ci: move test environment variable declaration to .cirrus.yml
dcbe84b841 bench: add --help option to bench.
099bad945e Comment and check a parameter for inf in secp256k1_ecmult_const.
6c0be857f8 Verify that secp256k1_ge_set_gej_zinv does not operate on infinity. a->x and a->y should not be used if the infinity flag is set.
4900227451 Merge bitcoin-core/secp256k1#1025: build: replace backtick command substitution with $()
7c7ce872a5 build: Add a check that Valgrind actually supports a host platform
a4875e30a6 refactor: Move default callbacks to util.h
4c94c55bce doc: Remove obsolete hint for valgrind stack size
5106226991 exhaustive_tests: Fix with ecmult_gen table with custom generator
e1a76530db refactor: Make generator a parameter of ecmult_gen_create_prec_table
9ad09f6911 refactor: Rename program that generates static ecmult_gen table
8ae18f1ab3 refactor: Rename file that contains static ecmult_gen table
00d2fa116e ecmult_gen: Make code consistent with comment
3b0c2185ea ecmult_gen: Simplify ecmult_gen context after making table static
2b7c7497ef build: replace backtick command substitution with $()
49f608de47 Merge bitcoin-core/secp256k1#1004: ecmult: fix definition of STRAUSS_SCRATCH_OBJECTS
c0cd7de6d4 build: add -no-undefined to libtool LDFLAGS
fe32a79d35 build: pass win32-dll to LT_INIT
60bf8890df ecmult: fix definition of STRAUSS_SCRATCH_OBJECTS
fecf436d53 Merge bitcoin-core/secp256k1#1019: build: don't append valgrind CPPFLAGS if not installed (macOS)
2e5e4b67df Merge bitcoin-core/secp256k1#1020: doc: remove use of <0xa0> "no break space"
812ff5c747 doc: remove use of 0xa0 "no break space"
214042a170 build: don't append valgrind CPPFLAGS if not installed
e43ba02cfc refactor: Decouple table generation and ecmult_gen context
22dc2c0a0d ecmult_gen: Move table creation to new file and force static prec
793ad9016a Merge bitcoin-core/secp256k1#1010: doc: Minor fixes in safegcd_implementation.md
dc9b6853b7 doc: Minor fixes in safegcd_implementation.md
ea5e8a9c47 Merge bitcoin-core/secp256k1#1012: Fix typos
233297579d Fix typos
7006f1b97f Merge bitcoin-core/secp256k1#1011: ci: Enable -g if we set CFLAGS manually
72de1359e9 ci: Enable -g if we set CFLAGS manually
74c34e727b Merge bitcoin-core/secp256k1#1009: refactor: Use (int)&(int) in boolean context to avoid compiler warning
16d132215c refactor: Use (int)&(int) in boolean context to avoid compiler warning
c74a7b7e51 Merge bitcoin-core/secp256k1#1007: doc: Replace apoelstra's GPG key by jonasnick's GPG key
3b157c48ed doc: Suggest keys.openpgp.org as keyserver in SECURITY.md
73a7472cd0 doc: Replace apoelstra's GPG key by jonasnick's GPG key
515a5dbd02 Merge bitcoin-core/secp256k1#991: Merge all "external" benchmarks into a single bench binary
af6abcb3d0 Make bench support selecting which benchmarks to run
9f56bdf5b9 Merge bench_schnorrsig into bench
3208557ae1 Merge bench_recover into bench
855e18d8a8 Merge bench_ecdh into bench
2a7be678a6 Combine bench_sign and bench_verify into single bench
8fa41201bd Merge bitcoin-core/secp256k1#1002: Make aux_rnd32==NULL behave identical to 0x0000..00.
5324f8942d Make aux_rnd32==NULL behave identical to 0x0000..00.
21c188b3c5 Merge bitcoin-core/secp256k1#943: VERIFY_CHECK precondition for secp256k1_fe_set_int.
3e7b2ea194 Merge bitcoin-core/secp256k1#999: bench_ecmult: improve clarity of output
23e2f66726 bench: don't return 1 in have_flag() if argc = 1
96b1ad2ea9 bench_ecmult: improve clarity of output
20d791edfb Merge bitcoin-core/secp256k1#989: Shared benchmark format for command line and CSV outputs
aa1b889b61 Merge bitcoin-core/secp256k1#996: Fix G.y parity in sage code
044d956305 Fix G.y parity in sage code
b4b130678d create csv file from the benchmark output
26a255beb6 Shared benchmark format for command line and CSV outputs
9526874d14 Merge bitcoin-core/secp256k1#810: Avoid overly-wide multiplications in 5x52 field mul/sqr
920a0e5fa6 Merge bitcoin-core/secp256k1#952: Avoid computing out-of-bounds pointer.
f34b5cae03 Merge bitcoin-core/secp256k1#983: [RFC] Remove OpenSSL testing support
297ce82091 Merge bitcoin-core/secp256k1#966: Make aux_rand32 arg to secp256k1_schnorrsig_sign const
2888640132 VERIFY_CHECK precondition for secp256k1_fe_set_int.
d49011f54c Make _set_fe_int( . , 0 ) set magnitude to 0
bc08599e77 Remove OpenSSL testing support
10f9bd84f4 Merge bitcoin-core/secp256k1#987: Fix unused parameter warnings when building without VERIFY
189f6bcfef Fix unused parameter warnings when building without VERIFY
da0092bccc Merge bitcoin-core/secp256k1#986: tests: remove `secp256k1_fe_verify` from tests.c and modify `_fe_from_storage` to call `_fe_verify`
d43993724d tests: remove `secp256k1_fe_verify` from tests.c and modify `secp256k1_fe_from_storage` to call `secp256k1_fe_verify`
2a3a97c665 Merge bitcoin-core/secp256k1#976: `secp256k1_schnorrsig_sign_internal` should be static
aa5d34a8fe Merge bitcoin-core/secp256k1#783: Make the public API docs more consistent and explicit
72713872a8 Add missing static to secp256k1_schnorrsig_sign_internal
db4667d5e0 Make aux_rand32 arg to secp256k1_schnorrsig_sign const
9a5a87e0f1 Merge bitcoin-core/secp256k1#956: Replace ecmult_context with a generated static array.
20abd52c2e Add tests for pre_g tables.
6815761cf5 Remove ecmult_context.
f20dcbbad1 Correct typo.
16a3cc07e8 Generate ecmult_static_pre_g.h
8de2d86a06 Bump memory limits in advance of making the ecmult context static.
d7ec49a689 Merge bitcoin-core/secp256k1#969: ci: Fixes after Debian release
5d5c74a057 tests: Rewrite code to circument potential bug in clang
3d2f492ceb ci: Install libasan6 (instead of 5) after Debian upgrade
adec5a1638 Add missing null check for ctx and input keys in the public API
f4edfc7581 Improve consistency for NULL arguments in the public interface
9be7b0f083 Avoid computing out-of-bounds pointer.
b53e0cd61f Avoid overly-wide multiplications

git-subtree-dir: src/secp256k1
git-subtree-split: 0559fc6e41b65af6e52c32eb9b1286494412a162
2021-12-15 09:19:50 -05:00
Hennadii Stepanov
b8cc75435a
Merge bitcoin-core/gui#508: Prevent negative values of progressPerHour
71d33380ed qt: prevent negative values of progressPerHour (HiLivin)

Pull request description:

  Added a similar guard to _progressPerHour_ as is placed at _remainingMSecs_.
  It prevents the display of negative values like "-0.00%" in some cases.

ACKs for top commit:
  hebasto:
    ACK 71d33380ed
  jarolrod:
    ACK 71d3338
  shaavan:
    reACK 71d33380ed

Tree-SHA512: 5427cdf4441b542196008034355ea00a075adf8b9aeeb383bacdb4e5fbda23d665448a50035aac93cbf401d5d6211d39a2c7c294568d9f5548a5c7579e201c44
2021-12-15 15:10:20 +02:00
seaona
71115a5e23 test: include two more interruptions points 2021-12-15 13:32:32 +01:00
josibake
bf4f817135
refactor: addrman_select test
Check that `Good()` is successful whenever it is called.
2021-12-15 13:19:19 +01:00
josibake
5a64dc018c
refactor: addrman_evictionworks test
Test for collisions and duplicates directly with `Good()`.

If an entry to tried is a duplicate, `Good()` will return false
but `SelectTriedCollision()` will be empty (assuming there were no prior
collisions). If there is a collision, `Good()` will retun false
and `SelectTriedCollision()` will return a value.
2021-12-15 13:18:07 +01:00
josibake
e281fccd8a
refactor: addrman_noevict test
Check the response from `Good()` wherever it is called.

Previously, the test was using `size()` (incorrect for checking tried)
and `SelectTriedCollision()` to determine if a collision happened.
2021-12-15 13:17:46 +01:00
josibake
8bdd9240d4
refactor: addrman_selecttriedcollisions test
Check `Good()` directly when adding addresses.
Previously, test would check `size()`, which is incorrect.

Check that duplicates are also handled by checking the
output from `SelectTriedCollision()` when `Good()` returns
false.
2021-12-15 13:15:22 +01:00
Hennadii Stepanov
edd0313ae7
test: Improve "invalid_command" subtest in system_tests for Windows
No need to explain code with comments.
2021-12-15 14:09:31 +02:00
Hennadii Stepanov
fb1b0590af
test: Fix "non-zero exit code" subtest in system_tests for Windows 2021-12-15 14:09:31 +02:00
Hennadii Stepanov
0aad33db64
test: Fix "false" subtest in system_tests for Windows 2021-12-15 14:09:30 +02:00
Hennadii Stepanov
507c009c1e
test: Fix "echo" subtest in the system_tests for Windows 2021-12-15 14:09:30 +02:00
MarcoFalke
60b5795133
Merge bitcoin/bitcoin#23758: net: Use type-safe mockable time for peer connection time
fad943821e scripted-diff: Rename touched member variables (MarcoFalke)
fa663a4c0d Use mockable time for peer connection time (MarcoFalke)
fad7ead146 refactor: Use type-safe std::chrono in net (MarcoFalke)

Pull request description:

  Benefits:
  * Type-safe
  * Mockable
  * Allows to revert a temporary test workaround

ACKs for top commit:
  naumenkogs:
    ACK fad943821e
  shaavan:
    ACK fad943821e

Tree-SHA512: af9bdfc695ab727b100c6810a7289d29b02b0ea9fa4fee9cc1f3eeefb52c8c465ea2734bae0c1c63b3b0d6264ba2c493268bc970ef6916570eb166de77829d82
2021-12-15 13:07:34 +01:00
W. J. van der Laan
2d0bdb2089
Merge bitcoin/bitcoin#22362: Drop only invalid entries when reading banlist.json
faa6c3d44c net: Drop only invalid entries when reading banlist.json (MarcoFalke)

Pull request description:

  All entries will be dropped when there is at least one invalid one in `banlist.json`. Fix this by only dropping invalid ones.

  Also suggested in https://github.com/bitcoin/bitcoin/pull/20966#issuecomment-861150204

ACKs for top commit:
  laanwj:
    Re-ACK faa6c3d44c

Tree-SHA512: 5a58e7f1dcabf78d0c65d8c6d5d997063af1efeaa50ca7730fc00056fda7e0061b6f7a38907ea045fe667c9f61d392e01e556b425a95e6b126e3c41cd33deb83
2021-12-15 12:02:35 +01:00
fanquake
965ffe2bed
Merge bitcoin/bitcoin#23757: [build] Android: fix GUI not loading on Qt 5.15
27f353d8ef build, android: Fix Android GUI not loading on Qt 5.15 (Igor Cota)
6fc5c772d4 build, qt: use static QAndroidPlatformIntegrationPlugin (Igor Cota)

Pull request description:

  PR moved from https://github.com/bitcoin-core/gui/pull/504 as it escaped the confines of `src/qt`.

ACKs for top commit:
  hebasto:
    re-ACK 27f353d8ef
  promag:
    utACK 27f353d8ef

Tree-SHA512: 4b6e6b2fb1923b89934f11caa8c05c6f340881689273f0c08916144e623f03fd5b781f1a53af83f6e87dce211fe02a1cb87e5943d13811c791cc8aa458184d9f
2021-12-15 18:37:15 +08:00
MarcoFalke
b67115dd04
Merge bitcoin/bitcoin#23174: validation: have LoadBlockIndex account for snapshot use
2283b9cd1e test: add tests for LoadBlockIndex when using multiple chainstates (James O'Beirne)
0fd599a51a validation: have LoadBlockIndex account for snapshot use (James O'Beirne)
d0c6e61f5d validation: don't modify genesis during snapshot load (James O'Beirne)

Pull request description:

  This is part of the [assumeutxo project](https://github.com/bitcoin/bitcoin/projects/11) (parent PR: #15606)

  ---

  Currently, `BlockManager::LoadBlockIndex` adds all blocks that have downloaded transactions to the active chain state's `setBlockIndexCandidates` set, ignoring the background chain state.

  This PR changes ChainstateManager::LoadBlockIndex to update `setBlockIndexCandidates` in the background chain, not just the active chain. In the active chain, the same blocks are added as before. In the background chain, only blocks that have actually been validated, not blocks marked assumed-valid are added so the background chain will continue to download and validate assumed-valid blocks.

ACKs for top commit:
  MarcoFalke:
    Concept ACK 2283b9cd1e 🤽
  Sjors:
    utACK 2283b9cd1e

Tree-SHA512: 7c9a80802df4722d85d12b78d2e7f628ac5f11cb8be66913d5c3230339bd1220c6723805509d4460826a17d1dc04b0ae172eb7d09ac0ea5dc5e41d77975cbd5e
2021-12-15 11:05:31 +01:00
Martin Zumsande
e4a8d561ed doc: add explanations for assert in index and magic numbers in test
These were suggested in review of #23365

Co-authored-by: John Newbery <john@johnnewbery.com>
2021-12-15 10:05:11 +00:00
MarcoFalke
7006496a5c
Merge bitcoin/bitcoin#23756: refactor: Fix implicit integer sign changes in strencodings
fa5865a9e3 Reduce size of strencodings decode tables (MarcoFalke)
fad6761cf7 Fix implicit integer sign changes in strencodings (MarcoFalke)

Pull request description:

  This removes casts where they are nonsensical (ToUpper/ToLower) and adds them where needed. Then, remove the suppressions.

  Also, reduce static memory usage.

ACKs for top commit:
  shaavan:
    crACK fa5865a9e3

Tree-SHA512: 29850fb616789befad17f71731f322b2238e94ec431cda293629de540f7ab02060a9fc5b7666168ca2592048df5a39a2975177f47771d4d8211d90321052549d
2021-12-15 10:59:28 +01:00
MarcoFalke
40fdb9ece9
Merge bitcoin/bitcoin#23713: refactor, test: refactor addrman_tried_collisions test to directly check for collisions
caac999ff0 refactor: remove dependence on AddrManTest (josibake)
f961c477b5 refactor: check Good() in tried_collisions test (josibake)
207f1c825c refactor: make AddrMan::Good return bool (josibake)

Pull request description:

  Previously, the `addrman_tried_collisions` test behaved in the following way:

  1. add an address to addrman
  2. attempt to move the new address to the tried table (using `AddrMan.Good()`)
  3. verify that `num_addrs` matched `size()` to check for collisions in the new table

  `AddrMan.size()`, however, returns the number of unique address in addrman, regardless of whether they are in new or tried. This means the test would still pass for addresses where a collision did occur in the tried table. After 3 collisions in the tried table, there would eventually be a collision in the new table when trying to add a new address, which was then detected by checking `num_addrs - collisions == size()`.

  While the collision in the new table was caused by a collision in the tried table, the test is misleading as it's not directly testing for collisions in the tried table and misses 3 collisions before identifying a collision in the new table.

  ### solution

  To more directly test the tried table, I refactored `AddrMan::Good()` to return a boolean after successfully adding an address to the tried table. This makes the test much cleaner by first adding an address to new, calling `Good` to move it to the tried table, and checking if it was successful or not. It is worth noting there are other reasons, aside from collisions, which will cause `Good` to return false. That being said, this is an improvement over the previous testing methodology.

  Additionally, having `Good()` return a boolean is useful outside of testing as it allows the caller to handle the case where `Good` is unable to move the entry to the tried table (e.g a063647413/src/rpc/net.cpp (L945)).

  ### followup
  As a follow up to this PR, I plan to look at the following places `Good()` is called and see if it makes sense to handle the case where it is unable to add an entry to tried:

  * a063647413/src/rpc/net.cpp (L945)
  * a063647413/src/net.cpp (L2067)
  * a063647413/src/net_processing.cpp (L2708)

ACKs for top commit:
  jnewbery:
    utACK caac999ff0
  mzumsande:
    Code review ACK caac999ff0

Tree-SHA512: f328896b1f095e8d2581fcdbddce46fc0491731a0440c6fff01081fa5696cfb896dbbe1d183eda2c100f19aa111e1f8b096ef93582197edc6b791de563a58f99
2021-12-15 09:53:23 +01:00
w0xlt
4807f73f48 refactor: Implement restorewallet() logic in the wallet section
Currently restorewallet() logic is written in the RPC layer
and it can´t be reused by GUI. So it reimplements this in the
wallet and interface sections and then, GUI can access it.
2021-12-14 19:18:56 -03:00
HiLivin
71d33380ed qt: prevent negative values of progressPerHour
Added a similar guard to progressPerHour as is placed at remainingMSecs.
It prevents the display of negative values like "-0.00%" in some cases.
2021-12-14 19:40:39 +01:00
MarcoFalke
faa6c3d44c
net: Drop only invalid entries when reading banlist.json
Currently all entries in the file are dropped. Fix that by only dropping the invalid ones
2021-12-14 18:58:45 +01:00
MarcoFalke
9015d11842
Merge bitcoin/bitcoin#23774: tests: Add missing assert_equal import to p2p_add_connections.py
efa115aa4a tests: Add missing assert_equal import to p2p_add_connections.py (Andrew Chow)

Pull request description:

ACKs for top commit:
  MarcoFalke:
    code review ACK efa115aa4a and apologies for missing the silent merge conflict in merge commit 9635760ce8

Tree-SHA512: e5782f9883f37265db4e1977b5df82cc689fb99080cc92888b425937da75050a49a8e196b857333c5382567b5c0439d54ef72f5556aca8de5c1bffdf7b2f8b8b
2021-12-14 18:32:38 +01:00
Andrew Chow
efa115aa4a tests: Add missing assert_equal import to p2p_add_connections.py 2021-12-14 12:28:25 -05:00
MarcoFalke
fa1dc9b36a
p2p: Always serialize local timestamp for version msg 2021-12-14 18:04:48 +01:00
MarcoFalke
9635760ce8
Merge bitcoin/bitcoin#22777: net processing: don't request tx relay on feeler connections
eaf6be0114 [net processing] Do not request transaction relay from feeler connections (John Newbery)
0220b834b1 [test] Add testing for outbound feeler connections (John Newbery)

Pull request description:

  Feelers are short-lived connections used to test the viability of peers. The bitcoind node will periodically open feeler connections to addresses in its addrman, wait for a `version` message from the peer, and then close the connection.

  Currently, we set `fRelay` to `1` in the `version` message for feeler connections, indicating that we want the peer to relay transactions to us. However, we close the connection immediately on receipt of the `version` message, and so never process any incoming transaction announcements. This PR changes that behaviour to instead set `fRelay` to `0` indicating that we do not wish to receive transaction announcements from the peer.

  This PR also extends the `addconnection` RPC to allow creating outbound feeler connections from the node to the test framework, and a test to verify that the node sets `fRelay` to `0` in the `version` message to feeler connections.

ACKs for top commit:
  naumenkogs:
    ACK eaf6be0114
  MarcoFalke:
    review ACK eaf6be0114 🏃

Tree-SHA512: 1c56837dbd0a396fe404a5e39f7459864d15f666664d6b35ad109628b13158e077e417e586bf48946a23bd5cbe63716cb4bf22cdf8781b74dfce6047b87b465a
2021-12-14 17:57:10 +01:00
josibake
caac999ff0
refactor: remove dependence on AddrManTest 2021-12-14 17:50:50 +01:00
josibake
f961c477b5
refactor: check Good() in tried_collisions test
Rather than try to infer a collision by checking `AddrMan::size`,
check whether or not moving to the tried table was successful by
checking the output from `AddrMan::Good`
2021-12-14 17:50:49 +01:00
josibake
207f1c825c
refactor: make AddrMan::Good return bool
If AddrMan::Good is unable to add an entry
to tried (for a number of reasons), return false.

This makes it much easier and cleaner to directly
test for tried collisions. It also allows anyone
calling Good() to handle the case where adding an
address to tried is unsuccessful.

Update docs to doxygen style.
2021-12-14 17:50:24 +01:00
fanquake
498fe4b780
Merge bitcoin/bitcoin#23575: fuzz: Rework FillNode
fa19bab90a fuzz: Rework FillNode (MarcoFalke)
fae6e31df7 refactor: Set fSuccessfullyConnected in FillNode (MarcoFalke)
fa3583f856 fuzz: Avoid negative NodeId in ConsumeNode (MarcoFalke)

Pull request description:

  Currently `FillNode` is a bit clumsy because it directly modifies memory of `CNode`. This gets in the way of moving that memory to `Peer`. Also, it isn't particularly consistent. See for example https://github.com/bitcoin/bitcoin/pull/21160#discussion_r739206139 .

  Fix all issues by sending a `version`/`verack` in `FillNode` and let net_processing figure out the internal details.

ACKs for top commit:
  jnewbery:
    Strong concept ACK and light code review ACK fa19bab90a

Tree-SHA512: 33261d857c3fa6d5d39d742624009a29178ad5a15eb3fd062da741affa5a4854fd45ed20d59a6bba2fb068cf7b39cad6f95b2910be7cb6afdc27cd7917955b67
2021-12-14 20:40:58 +08:00
MarcoFalke
faf2614f60
style: Use 4 spaces for indendation, not 5
Also, other whitespace fixes in the touched file.

Can be trivially reviewed with "--ignore-all-space --word-diff-regex=. -U0".
2021-12-14 12:44:30 +01:00
MarcoFalke
fada66fc2c
Disallow copies of CChain 2021-12-14 12:42:33 +01:00
MarcoFalke
aaaceb7fb1
Merge bitcoin/bitcoin#23766: refactor: remove unneeded calls to strprintf()
eca159c305 refactor: remove unneeded calls to strprintf() (fanquake)

Pull request description:

ACKs for top commit:
  laanwj:
    Code review ACK eca159c305

Tree-SHA512: 6f0b25dd6506f7223e3603f89c9d6e33feb9a7b524986146f70d10973b7a346830889656b37b2ab5cf78ddea458ca6979dd848403a900cb79f62a1494b968f99
2021-12-14 10:27:22 +01:00
MarcoFalke
6c04b505b4
Merge bitcoin/bitcoin#23471: doc: Improve ZMQ documentation
9544ab60ce doc: Improve ZMQ documentation (node01)

Pull request description:

  This PR intends to clarify:

  . when ZMQ notifications occur
  . the message structure of each topic

  Closes https://github.com/bitcoin/bitcoin/issues/23452#issue-1046579585

ACKs for top commit:
  theStack:
    ACK 9544ab60ce

Tree-SHA512: 3b1314ad5eb8c359ffabd91ce9b47cf6cf8efa69be083a3bb5d865833ac67d7a88a8e012c4a4f59f2cd2a0e7f491e828897e85e9d01bae72ee83c4a6ad459f6e
2021-12-14 10:07:56 +01:00
MarcoFalke
87ce2d646b
Merge bitcoin/bitcoin#22822: doc: Add multisig tutorial
1ef2c03452 Add multisig tutorial (lsilva01)

Pull request description:

  This PR adds a mutisig tutorial, as requested in https://github.com/bitcoin/bitcoin/issues/21278

  Although there is already a brief explanation and a functional test about the multisig implemented in https://github.com/bitcoin/bitcoin/pull/22067, this tutorial proposes to use the signet (instead of regtest), bringing the reader closer to a real environment and explaining some functions in more detail.

  I'm not sure if this format should be in this repository or on some wiki page. But as there is an open issue regarding this matter, that is my suggestion.

ACKs for top commit:
  Sjors:
    re-utACK 1ef2c03452
  prayank23:
    ACK 1ef2c03452

Tree-SHA512: 2c3f17a8c50e554f802029dceb28ab90a77021f135b8cbd77dca3879ba1f1a0eac6bda0afb90d1ff6b8116fb0628471687d3fb77bb255ef5d8b9590b775cbce9
2021-12-14 09:58:50 +01:00
fanquake
eca159c305
refactor: remove unneeded calls to strprintf() 2021-12-14 10:09:42 +08:00
fanquake
ab879d9885
Merge bitcoin/bitcoin#23762: wallet: Replace Assume with Assert where needed in coinselection
fa26c55644 wallet: Replace Assume with Assert where needed in coinselection (MarcoFalke)

Pull request description:

  `Assume` should only be used when a failed check is recoverable. The checks here don't recover and would run into UB, so use `Assert` instead.

ACKs for top commit:
  theStack:
    Code-review ACK fa26c55644

Tree-SHA512: 0cf9435f9ec44794022ce0274cba602aec95102ab73f4c8a93dae54ef4c0a594f6a81640477039719ddfb6f23b05f8ece3e4886ef7f8a725efff45685ac49d92
2021-12-14 09:27:27 +08:00
James O'Beirne
2283b9cd1e
test: add tests for LoadBlockIndex when using multiple chainstates
Incorporates feedback from Russ Yanofsky.
2021-12-13 13:45:28 -05:00
James O'Beirne
0fd599a51a
validation: have LoadBlockIndex account for snapshot use
Ensure that blocks past the snapshot base block (i.e. the end of the
assumed-valid region of the chain) are not included in
setBlockIndexCandidates for the background validation chainstate. These
blocks, while fully validated and lacking the BLOCK_ASSUMED_VALID flag,
*rely* on blocks which are assumed-valid, and so shouldn't be added to
the IBD chainstate.

Co-authored-by: Russ Yanofsky <russ@yanofsky.org>
2021-12-13 13:45:27 -05:00
James O'Beirne
d0c6e61f5d
validation: don't modify genesis during snapshot load
Avoid modifying the genesis block index entry during snapshot load. This
is because, in a future change that fixes LoadBlockIndex for UTXO
snapshots, we detect block index entries that are reliant on
assumed-valid ancestors and treat them specially.

Since the genesis block doesn't have BLOCK_VALID_SCRIPTS, it would be
erroneously marked BLOCK_ASSUMED_VALID during snapshot load if we didn't
skip it here. This would cause a "setBlockIndexCandidates() empty"
assertion to be tripped since all block index entries would be marked
assume-valid due to genesis, which is never re-validated.

There's probably no good reason to modify the genesis block index entry
during snapshot load anyway...
2021-12-13 13:45:22 -05:00
Igor Cota
27f353d8ef build, android: Fix Android GUI not loading on Qt 5.15
Qt 5.14 introduced certain breaking changes to the way it parses
AndroidManifest.xml metadata

https://lists.qt-project.org/pipermail/interest/2020-January/034372.html
2021-12-13 19:27:46 +01:00
Igor Cota
6fc5c772d4 build, qt: use static QAndroidPlatformIntegrationPlugin 2021-12-13 19:24:33 +01:00
MarcoFalke
5dd28e5cff
Merge bitcoin/bitcoin#23755: rpc: Quote user supplied strings in error messages
fa24a3df87 rpc: Quote user supplied strings in error messages (MarcoFalke)

Pull request description:

  I can't see a downside doing this and this fixes a fuzzing crash

  Background:

  This is a follow-up to commit 926fc2a0d4, which introduced the "starts_with-hack". Maybe an alternative to the hack would be to assign a unique error code to internal bugs? However, I think this can be done in an separate pull request and the changes here make sense even on their own.

ACKs for top commit:
  fanquake:
    ACK fa24a3df87 - to fix the fuzzers.

Tree-SHA512: d998626406a64396a037a6d1fce22fce3dadb7567c2f9638e450ebe8fb8ae77d134e15dd02555326732208f698d77b0028bc62be9ceee9c43282b61fe95fccbd
2021-12-13 17:13:42 +01:00
MarcoFalke
42796742a4
Merge bitcoin/bitcoin#23761: build: use __SIZEOF_INT128__ for checking __int128 availability
e9440aeb5c build: use __SIZEOF_INT128__ for checking __int128 availability (fanquake)

Pull request description:

  We already use this in the blockfilter code,

  bf66e258a8/src/blockfilter.cpp (L34-L36)

  so not sure we need to maintain two different ways of testing
  for the same functionality. Consolidate on testing for `__SIZEOF_INT128__`,
  which we already use, is supported by the compilers we care about, and is
  also used by libsecp256k1.

ACKs for top commit:
  sipa:
    utACK e9440aeb5c
  Zero-1729:
    crACK e9440aeb5c

Tree-SHA512: 8aeef1734486a863b5091123bb5f9ba8868b1e2b4b35114586e3eb5862a38d4a1518ed069f37f41cb5e5ce2f6c87d95671996366d5ee990e0c90f268a8978ba3
2021-12-13 17:10:29 +01:00
MarcoFalke
c8fac372c2
Merge bitcoin/bitcoin#23648: test: Use byte unit 'M' for -maxuploadtarget functional test
41b9f7d062 test: Use byte unit 'M' for -maxuploadtarget functional test (Douglas Chimento)

Pull request description:

ACKs for top commit:
  shaavan:
    ACK 41b9f7d062
  stratospher:
    ACK 41b9f7d.

Tree-SHA512: 25b46347c671e8d6fd8878e7fee40e773bb03641e53e41e8a79a286fe4a0cf71c0c0986d6d7418fcb656c07f7216cc50a7ee4366f9213c32b01ae74326031f80
2021-12-13 16:31:42 +01:00
MarcoFalke
fa24a3df87
rpc: Quote user supplied strings in error messages 2021-12-13 15:18:35 +01:00
MarcoFalke
767c012665
Merge bitcoin/bitcoin#23738: validation, log: improve logging of ChainstateManager snapshot persistance
50209a42ad validation, doc: remove TODO comment (Jon Atack)
8e37fa8393 validation, log: improve logging in FlushSnapshotToDisk() (Jon Atack)
271252c0bd validation, log: extract FlushSnapshotToDisk() function (Jon Atack)

Pull request description:

  Use the `LOG_TIME_MILLIS_WITH_CATEGORY_MSG_ONCE` macro to improve the logging of ChainstateManager snapshot persistance, log task start and completion separately and no longer manually track the duration, as suggested by Marco Falke in https://github.com/bitcoin/bitcoin/pull/22872#discussion_r715571280.

  Extract the flushing into one function, which clarifies the logic, extends the improved logging to both flushing call sites, and allows logging the prefix `FlushSnapshotToDisk`, which is similar to `FlushStateToDisk`.

  before
  ```
  [snapshot] flushing coins cache (0 MB)... done (0.00ms)

  [snapshot] flushing snapshot chainstate to disk
  ```
  after
  ```
  FlushSnapshotToDisk: flushing coins cache (0 MB) started
  ...
  FlushSnapshotToDisk: completed (0.00ms)

  FlushSnapshotToDisk: saving snapshot chainstate (0 MB) started
  ...
  FlushSnapshotToDisk: completed (0.00ms)
  ```
  The logging can be observed in the output of
  ```
  ./src/test/test_bitcoin -t validation_chainstate_tests -- DEBUG_LOG_OUT
  ```

Top commit has no ACKs.

Tree-SHA512: 5d954cd8c7455f8625152a43663a237f04717bb834aed62925a56e17c711fca6ccfc03783970b6b0bde44f64617d804b423a7048287c06ee816db36247acf272
2021-12-13 15:07:17 +01:00
James O'Beirne
826e12b010
test: call VerifyLoadedChainstate during ChainTestingSetup
for additional coverage and similarity to actual init process.
2021-12-13 09:04:19 -05:00