aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2021-04-13Merge #21467: Move external signer out of wallet modulefanquake
88d4d5ff2f5c71a9a2f4c78c2b2e2fd00568cfee rpc: add help for enumeratesigners and walletdisplayaddress (Sjors Provoost) b0db187e5b30a491c9f95685430a82a1e35e921d ci: use --enable-external-signer instead of --with-boost-process (Sjors Provoost) b54b2e7b1a171203404bd41853372c73f2c64532 Move external signer out of wallet module (Sjors Provoost) Pull request description: In addition, this PR enables external signer testing on CI. This PR moves the ExternalSigner class and RPC methods out of the wallet module. The `enumeratesigners` RPC can be used without a wallet since #21417. With additional modifications external signers could be used without a wallet in general, e.g. via `signrawtransaction`. The `signerdisplayaddress` RPC is ranamed to `walletdisplayaddress` because it requires wallet context. A future `displayaddress` RPC call without wallet context could take a descriptor argument. This commit fixes a `rpc_help.py` failure when configured with `--disable-wallet`. ACKs for top commit: ryanofsky: Code review ACK 88d4d5ff2f5c71a9a2f4c78c2b2e2fd00568cfee fanquake: ACK 88d4d5ff2f5c71a9a2f4c78c2b2e2fd00568cfee Tree-SHA512: 3242a24e22313aed97eee32a520bfcb1c17495ba32a2b8e06a5e151e2611320e2da5ef35b572d84623af0a49a210d2f9377a2531250868d1a0ccf3e144352a97
2021-04-13Merge #21631: i2p: always check the return value of Sock::Wait()MarcoFalke
1c1467f51b6dda92dec974eb59026c2c5ba79ed6 i2p: cancel the Accept() method if waiting on the socket errors (Vasil Dimov) Pull request description: If `Sock::Wait()` fails, then cancel the `Accept()` method. Not checking the return value may cause an uninitialized read a few lines below when we read the `occurred` variable. [Spotted](https://github.com/bitcoin/bitcoin/pull/21630#issuecomment-814765659) by MarcoFalke, thanks! ACKs for top commit: laanwj: Code review ACK 1c1467f51b6dda92dec974eb59026c2c5ba79ed6 practicalswift: cr ACK 1c1467f51b6dda92dec974eb59026c2c5ba79ed6: patch looks correct and agree with laanwj that `[[nodiscard]]` can be taken in a follow-up PR :) Tree-SHA512: 57fa8a03a4e055999e23121cd9ed1566a585ece0cf68b74223d8c902804cb6890218c9356d60e0560ccacc6c8542a526356c226ebd48e7b299b4572be312d49b
2021-04-13Merge #21330: Deal with missing data in signature hashes more consistentlyfanquake
725d7ae0494d4a45f5a840bbbd19c008a7363965 Use PrecomputedTransactionData in signet check (Pieter Wuille) 497718b467330b2c6bb0d44786020c55f1aa75f9 Treat amount<0 also as missing data for P2WPKH/P2WSH (Pieter Wuille) 3820090bd619ac85ab35eff376c03136fe4a9f04 Make all SignatureChecker explicit about missing data (Pieter Wuille) b77b0cc507bdc716e5236b1d9880e648147e0af9 Add MissingDataBehavior and make TransactionSignatureChecker handle it (Pieter Wuille) Pull request description: Currently we have 2 levels of potentially-missing data in the transaction signature hashes: * P2WPKH/P2WSH hashes need the spent amount * P2TR hashes need all spent outputs (amount + scriptPubKey) Missing amounts are treated as -1 (thus leading to unexpected signature failures), while missing outputs in P2TR validation cause assertion failure. This is hard to extend for signing support, and also quite ugly in general. In this PR, an explicit configuration option to {Mutable,}TransactionSignatureChecker is added (MissingDataBehavior enum class) to either select ASSERT_FAIL or FAIL. Validation code passes ASSERT_FAIL (as at validation time all data should always be passed, and anything else is a serious bug in the code), while signing code uses FAIL. The existence of the ASSERT_FAIL option is really just an abundance of caution. Always using FAIL should be just fine, but if there were for some reason a code path in consensus code was introduced that misses certain data, I think we prefer as assertion failure over silently introducing a consensus change. Potentially useful follow-ups (not for this PR, in my preference): * Having an explicit script validation error code for missing data. * Having a MissingDataBehavior::SUCCEED option as well, for use in script/sign.cpp DataFromTransaction (if a signature is present in a witness, and we don't have enough data to fully validate it, we should probably treat it as valid and not touch it). ACKs for top commit: sanket1729: reACK 725d7ae0494d4a45f5a840bbbd19c008a7363965 Sjors: ACK 725d7ae0494d4a45f5a840bbbd19c008a7363965 achow101: re-ACK 725d7ae0494d4a45f5a840bbbd19c008a7363965 benthecarman: ACK 725d7ae0494d4a45f5a840bbbd19c008a7363965 fjahr: Code review ACK 725d7ae0494d4a45f5a840bbbd19c008a7363965 Tree-SHA512: d67dc51bae9ca7ef6eb9acccefd682529f397830f77d74cd305500a081ef55aede0e9fa380648c3a8dd4857aa7eeb1ab54fe808979d79db0784ac94ceb31b657
2021-04-11Merge #21602: rpc: add additional ban time fields to listbannedMarcoFalke
d3b0b08b0f04d2f1dbebbafd7ab0384dfe045dec doc: release notes for new listbanned fields (Jarol Rodriguez) 60290d3f5ec8e7e3b8cb1ebae02d5d72f6005184 test: increase listbanned unit test coverage (Jon Atack) 3e978d1a5dbd43f85bd03e759984ab1f209d6e34 rpc: add time_remaining field to listbanned (Jarol Rodriguez) 5456b345312857981cb426712f0665800c682e09 rpc: add ban_duration field to listbanned (Jarol Rodriguez) c95c61657afd058b46549fb3d65633d7c736f5fc doc: improve listbanned help (Jarol Rodriguez) dd3c8eaa3399b28dc78a883ff78cbe7cc5c31b5b rpc: swap position of banned_until and ban_created fields (Jarol Rodriguez) Pull request description: This PR adds a `ban_duration` and `time_remaining` field to the `listbanned` RPC command. Thanks to jonatack, this PR also expands the `listbanned` test coverage to include these new fields It's useful to keep track of `ban_duration` as this is another data point on which to sort banned peers. I found this helpful in adding additional context columns to the GUI `bantablemodel` as part of a follow-up PR. As [suggested](https://github.com/bitcoin/bitcoin/pull/21602#issuecomment-813486134) by jonatack, `time_remaining` is another useful user-centric data point. Since a ban always expires after its created, the `ban_created` field is now placed before the `banned_until` field. This new ordering is more logical. This PR also improves the `help listbanned` output by providing additional context to the descriptions of the `address`, `ban_created`, and `banned_until` fields. **Master: listbanned** ``` [ { "address": "1.2.3.4/32", "banned_until": 1617691101, "ban_created": 1617604701 }, { "address": "135.181.41.129/32", "banned_until": 1649140716, "ban_created": 1617604716 } ] ``` **PR: listbanned** ``` [ { "address": "1.2.3.4/32", "ban_created": 1617775773, "banned_until": 1617862173, "ban_duration": 86400, "time_remaining": 86392 }, { "address": "3.114.211.172/32", "ban_created": 1617753165, "banned_until": 1618357965, "ban_duration": 604800, "time_remaining": 582184 } ] ``` ACKs for top commit: jonatack: re-ACK d3b0b08b0f04d2f1dbebbafd7ab0384dfe045dec hebasto: ACK d3b0b08b0f04d2f1dbebbafd7ab0384dfe045dec, tested on Linux Mint 20.1 (x86_64). MarcoFalke: review ACK d3b0b08b0f04d2f1dbebbafd7ab0384dfe045dec 🕙 Tree-SHA512: 5b83ed2483344e546d57e43adc8a1ed7a1fff292124b14c86ca3a1aa2aec8b0f7198212fabff2c5145e7f726ca04ae567fe667b141254c7519df290cf63774e5
2021-04-09Merge #21606: fuzz: Extend psbt fuzz target a bitMarcoFalke
faaf3954e2f0089b6c6b9965f15e7f9af09c6fb0 fuzz: Extend psbt fuzz target a bit (MarcoFalke) Pull request description: Previously it only merged the psbt with itself, now it tries to merge another. ACKs for top commit: practicalswift: Tested ACK faaf3954e2f0089b6c6b9965f15e7f9af09c6fb0 Tree-SHA512: e1b1d31a47d35e1767285bc2fda176c79cb0550d6d383fe467104272e61e1c83f6cbc0c7d6bbc0c3027729eec13ae1f289f8950117ee91e0fb3703e66d5e6918
2021-04-09fuzz: Extend psbt fuzz target a bitMarcoFalke
2021-04-09Merge #21592: test: Remove option to make TestChain100Setup non-deterministicMarcoFalke
fa6183d7761eef8bb815aa888f0396e92e275f05 test: Remove option to make TestChain100Setup non-deterministic (MarcoFalke) fa732bccb3cf9bc2cdc444975286df0e799917a2 test: Use compressed keys in TestChain100Setup (MarcoFalke) Pull request description: Seems odd to have an option for non-deterministic tests when the goal should be for all tests to be deterministic. ACKs for top commit: jamesob: ACK https://github.com/bitcoin/bitcoin/pull/21592/commits/fa6183d7761eef8bb815aa888f0396e92e275f05 practicalswift: cr ACK fa6183d7761eef8bb815aa888f0396e92e275f05: patch looks deterministic! Tree-SHA512: 6897a9f36e0dfb7d63b25dd6984414b3ee8a62458ad232cb21ed5077184fdb0bc626996e4ac84ef0bdd452b9f17c54aac75a71575b8e723b84cac07c9f9d5611
2021-04-08Merge #21304: guix: Add guix-clean script + establish gc-root for container ↵W. J. van der Laan
profiles 867a5e172a23899a4a70eca4a396c64f1951745e guix: Register garbage collector root for containers (Carl Dong) 8f8b96fb542701b7717683caa3848390b24f77ab guix: Update hint messages to mention guix-clean (Carl Dong) 44f6d4f56b16e1dc5e8a23318b8e7aad0665f178 guix: Record precious directories and add guix-clean (Carl Dong) 84912d4b24382ae022da3a863bd6caa2b8948d94 build: Remove spaces from variable-printing rules (Carl Dong) Pull request description: ``` guix: Record precious directories and add guix-clean Many users have reported problems that stem from having an unclean working tree. To that end, I've written a guix-clean script which should help reset the working tree while respecting user-specified precious directories. Precious directories, such as: - SOURCES_PATH - BASE_CACHE - SDK_PATH - OUTDIR Should be preserved when cleaning the working tree, and are thus recorded in ./contrib/guix/var/precious_dirs. The ./contrib/guix/guix-clean script is able to parse that file and make sure to avoid them when cleaning out the working tree. ``` ACKs for top commit: laanwj: ACK 867a5e172a23899a4a70eca4a396c64f1951745e Tree-SHA512: c498fad781ff5e6406639df2b91b687fc528273fdf266bcdba8f6eec3b3b37ecce544b6da0252f0b9c6717f9d88e844e4c7b72d1877bdbabfc6871ddd0172af5
2021-04-08rpc: add help for enumeratesigners and walletdisplayaddressSjors Provoost
2021-04-08Move external signer out of wallet moduleSjors Provoost
This commit moves the ExternalSigner class and RPC methods out of the wallet module. The enumeratesigners RPC can be used without a wallet since #21417. With additional modifications external signers could be used without a wallet in general, e.g. via signrawtransaction. The signerdisplayaddress RPC is ranamed to walletdisplayaddress because it requires wallet context. A future displayaddress RPC call without wallet context could take a descriptor argument. This commit fixes a rpc_help.py failure when configured with --disable-wallet.
2021-04-08i2p: cancel the Accept() method if waiting on the socket errorsVasil Dimov
2021-04-08Merge #21574: Drop JSONRPCRequest constructors after #21366MarcoFalke
9044522ef76f880760165d98fab024802ccfc062 Drop JSONRPCRequest constructors after #21366 (Russell Yanofsky) Pull request description: This just makes an additional simplification after #21366 replaced util::Ref with std::any. It was originally suggested https://github.com/bitcoin/bitcoin/pull/21366#issuecomment-792044351 but delayed for a followup. It would have prevented usage bug https://github.com/bitcoin/bitcoin/pull/21572. ACKs for top commit: promag: ACK 9044522ef76f880760165d98fab024802ccfc062, fixed conflict in src/wallet/interfaces.cpp. Tree-SHA512: e909411b8f75013620b94e1a609296befb832fdcb574cd2e6689bfe3c636b03cd4ac1ccb2b32b532daf0f2131bb043464024966310fffc7e3cad77713d4bd0ef
2021-04-08test: Remove option to make TestChain100Setup non-deterministicMarcoFalke
Seems odd to have an option for non-deterministic tests when the goal should be for all tests to be deterministic. Can be reviewed with `--ignore-all-space`.
2021-04-08test: Use compressed keys in TestChain100SetupMarcoFalke
coinbaseKey.MakeNewKey(true); creates a compressed key and there is no reason for the deterministic setup to use uncompressed ones.
2021-04-08Merge #21626: doc: Fix typos from codespellfanquake
94c7dd9ac810a60f9c818c494273ad798cbac34b doc: Fix typos from codespell lint (Yerzhan Mazhkenov) Pull request description: Typos from codespell linter: https://cirrus-ci.com/task/6677401661865984?logs=lint#L856 - txrequest.cpp: `annoucements` ==> `announcements` - contrib/guix/README.md:298: `stil` ==> `still` - contrib/guix/guix-build:18: `invokable` ==> `invocable` - contrib/guix/libexec/prelude.bash:12: `invokable` ==> `invocable` - src/test/fuzz/tx_pool.cpp:37: `acess` ==> `access` - src/txorphanage.h:29: `orginating` ==> `originating` ACKs for top commit: practicalswift: cr ACK 94c7dd9ac810a60f9c818c494273ad798cbac34b: thnaks fro fiixng tpyos! jarolrod: ACK 94c7dd9ac810a60f9c818c494273ad798cbac34b Tree-SHA512: e0fac462a2f9e68b6a161c9f5d95b4d0648ce5c618fd7cd243d57db8f0256138b8823b166ea406b21e95586eae43047df1ef0df04616858082a39c1d1eb13a86
2021-04-07doc: Fix typos from codespell lintYerzhan Mazhkenov
2021-04-07Merge #21594: rpc: add network field to getnodeaddressesW. J. van der Laan
5c446784b10b168a6f649469a6627ac231eb1de2 rpc: improve getnodeaddresses help (Jon Atack) 1b9189866af26ed0003c1afe8dd5652ebe9b2e4a rpc: simplify/constify getnodeaddresses code (Jon Atack) 3bb6e7b6555f3c8743a697cb9d509620714dc483 rpc: add network field to rpc getnodeaddresses (Jon Atack) Pull request description: This patch adds a network field to RPC `getnodeaddresses`, which is useful on its own, particularly with the addition of new networks like I2P and others in the future, and which I also found helpful for adding a new CLI command as a follow-up to this pull that calls `getnodeaddresses` and needs to know the network of each address. While here, also improve the `getnodeaddresses` code and help. ``` $ bitcoin-cli -signet getnodeaddresses 3 [ { "time": 1611564659, "services": 1033, "address": "2600:1702:3c30:734f:8f2e:744b:2a51:dfa5", "port": 38333, "network": "ipv6" }, { "time": 1617531931, "services": 1033, "address": "153.126.143.201", "port": 38333, "network": "ipv4" }, { "time": 1617473058, "services": 1033, "address": "nsgyo7begau4yecc46ljfecaykyzszcseapxmtu6adrfagfrrzrlngyd.onion", "port": 38333, "network": "onion" } ] $ bitcoin-cli help getnodeaddresses getnodeaddresses ( count ) Return known addresses, which can potentially be used to find new nodes in the network. Arguments: 1. count (numeric, optional, default=1) The maximum number of addresses to return. Specify 0 to return all known addresses. Result: [ (json array) { (json object) "time" : xxx, (numeric) The UNIX epoch time when the node was last seen "services" : n, (numeric) The services offered by the node "address" : "str", (string) The address of the node "port" : n, (numeric) The port number of the node "network" : "str" (string) The network (ipv4, ipv6, onion, i2p) the node connected through }, ... ] ``` Future idea: allow passing `getnodeaddresses` a network (or networks) as an argument to return only addresses in that network. ACKs for top commit: laanwj: Tested ACK 5c446784b10b168a6f649469a6627ac231eb1de2 jarolrod: re-ACK 5c446784b10b168a6f649469a6627ac231eb1de2 promag: Code review ACK 5c446784b10b168a6f649469a6627ac231eb1de2. Tree-SHA512: ab0101f50c76d98c3204133b9f2ab6b7b17193ada31455ef706ad11afbf48f472fa3deb33e96028682369b35710ccd07d81863d2fd55c1485f32432f2b75efa8
2021-04-07rpc: improve getnodeaddresses helpJon Atack
2021-04-07rpc: simplify/constify getnodeaddresses codeJon Atack
2021-04-07rpc: add network field to rpc getnodeaddressesJon Atack
2021-04-07Merge #21572: Fix wrong wallet RPC context set after #21366MarcoFalke
937fd4a66f048780bffc5e714d0c800de987ce93 Fix wrong wallet RPC context set after #21366 (Russell Yanofsky) Pull request description: This bug doesn't have any effects currently because it only affects external signer RPCs which aren't currently using the wallet context, but it does cause an appveyor failure in a upcoming PR: https://ci.appveyor.com/project/DrahtBot/bitcoin/builds/38512882 This bug is subtle and could have been avoided if JSONRPCRequest didn't have constructors that were so loose with type checking. Suggested change https://github.com/bitcoin/bitcoin/pull/21366#issuecomment-792044351 eliminates these and would be a good followup for a future PR. This PR just implements the simplest possible fix. ACKs for top commit: theStack: Code-review ACK 937fd4a66f048780bffc5e714d0c800de987ce93 meshcollider: Code review ACK 937fd4a66f048780bffc5e714d0c800de987ce93 Tree-SHA512: 53e6265ed6c7abb47d2b3e77d1604edfeb993c3a2440f0c19679cfeb23516965e6707ff486196a0acfbeff21c79a9a08b5cd33bae9a232d33d0134bca1bd0ff3
2021-04-07Drop JSONRPCRequest constructors after #21366Russell Yanofsky
This just makes an additional simplification after #21366 replaced util::Ref with std::any. It was originally suggested https://github.com/bitcoin/bitcoin/pull/21366#issuecomment-792044351 but delayed for a followup. It would have prevented usage bug https://github.com/bitcoin/bitcoin/pull/21572.
2021-04-07Merge #21613: build: enable -Wdocumentationfanquake
a4e970adb6de8425025ae3f62fb89d9e27a8ab1f build: enable -Wdocumentation if suppressing external warnings (fanquake) 3b0078f958c46e94b468c829522ba965f5549f11 doc: fixup -Wdocumentation issues (fanquake) c6edcf1c710e4aaf1cafdbf8e86fe209b57bdeb8 build: suppress libevent warnings if supressing external warnings (fanquake) Pull request description: Enable `-Wdocumentation` by taking advantage of our `--enable-suppress-external-warnings` flag. Most of the CIs are using this flag now, so any regressions should be caught. This also required modifying libevents flags when suppressing warnings, as depending on the version being built against, that could generate a large number of warnings. i.e: ```bash In file included from httpserver.cpp:34: In file included from ./support/events.h:12: /usr/local/Cellar/libevent/2.1.12/include/event2/http.h:464:11: warning: parameter 'req' not found in the function declaration [-Wdocumentation] @param req a request object ^~~ /usr/local/Cellar/libevent/2.1.12/include/event2/http.h:465:11: warning: parameter 'databuf' not found in the function declaration [-Wdocumentation] @param databuf the data chunk to send as part of the reply. ^~~~~~~ /usr/local/Cellar/libevent/2.1.12/include/event2/http.h:467:11: warning: parameter 'call' not found in the function declaration [-Wdocumentation] @param call back's argument. ^~~~ /usr/local/Cellar/libevent/2.1.12/include/event2/http.h:939:4: warning: declaration is marked with '@deprecated' command but does not have a deprecation attribute [-Wdocumentation-deprecated-sync] @deprecated This function is deprecated; you probably want to use ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/Cellar/libevent/2.1.12/include/event2/http.h:946:1: note: add a deprecation attribute to the declaration to silence this warning char *evhttp_decode_uri(const char *uri); ^ __AVAILABILITY_INTERNAL_DEPRECATED /usr/local/Cellar/libevent/2.1.12/include/event2/http.h:979:5: warning: declaration is marked with '@deprecated' command but does not have a deprecation attribute [-Wdocumentation-deprecated-sync] @deprecated This function is deprecated as of Libevent 2.0.9. Use ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/Cellar/libevent/2.1.12/include/event2/http.h:987:1: note: add a deprecation attribute to the declaration to silence this warning int evhttp_parse_query(const char *uri, struct evkeyvalq *headers); ^ __AVAILABILITY_INTERNAL_DEPRECATED /usr/local/Cellar/libevent/2.1.12/include/event2/http.h:1002:11: warning: parameter 'query_parse' not found in the function declaration [-Wdocumentation] @param query_parse the query portion of the URI ^~~~~~~~~~~ /usr/local/Cellar/libevent/2.1.12/include/event2/http.h:1002:11: note: did you mean 'uri'? @param query_parse the query portion of the URI ^~~~~~~~~~~ uri 69 warnings generated. ``` Note that a lot of these have already been fixed upstream. ACKs for top commit: laanwj: Concept and code review ACK a4e970adb6de8425025ae3f62fb89d9e27a8ab1f practicalswift: cr ACK a4e970adb6de8425025ae3f62fb89d9e27a8ab1f: automatic compiler feedback comes sooner and is more reliable than manual reviewer feedback jonatack: Light ACK a4e970adb6de8425025ae3f62fb89d9e27a8ab1f skimmed the changes, clang 11 build is clean with the change, verified -Wdocumentation build warnings with this change when a doc fix was reverted Tree-SHA512: 57a1e30cffcc8bcceee72d85f58ebe29eae525861c70acb237541bd480c51ede89875c033042c0af376fdbb49fb7f588ef9282a47c6e78f9d4501c41f1b21eb6
2021-04-07Merge #21617: fuzz: Fix uninitialized read in i2p testMarcoFalke
33333755f2edcbe88fcd136f6fef81f94819002e fuzz: Fix uninitialized read in test (MarcoFalke) Pull request description: Can be tested with: ``` ./test/fuzz/test_runner.py -l DEBUG --valgrind ../btc_qa_assets/fuzz_seed_corpus/ i2p ``` ``` ==22582== Conditional jump or move depends on uninitialised value(s) ==22582== at 0x6BB2D8: __sanitizer_cov_trace_const_cmp1 (in /tmp/bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/fuzz) ==22582== by 0xB305DB: ConnectSocketDirectly(CService const&, Sock const&, int, bool) (netbase.cpp:570) ==22582== by 0x8AAA5D: i2p::sam::Session::Hello() const (i2p.cpp:284) ==22582== by 0x8A6FA0: i2p::sam::Session::CreateIfNotCreatedAlready() (i2p.cpp:352) ==22582== by 0x8A6742: i2p::sam::Session::Listen(i2p::Connection&) (i2p.cpp:134) ==22582== by 0x7A6C42: i2p_fuzz_target(Span<unsigned char const>) (i2p.cpp:37) ACKs for top commit: sipa: utACK 33333755f2edcbe88fcd136f6fef81f94819002e vasild: ACK 33333755f2edcbe88fcd136f6fef81f94819002e Tree-SHA512: 36073582b26b541324b3e55f3fd4a44abf89cb3081f36d361525daf8c27602fbc25f736510ec30df7cb4ca0c4e395e8d8a60f531bf6af358b5a3e65dbabf72c0
2021-04-07Merge #21540: wallet: refactor: dedup sqlite statement preparations/deletionsfanquake
ea19cc844e780b29825b26aee321204be981a3ae wallet: refactor: dedup sqlite statement deletions (Sebastian Falbesoner) 9a3670930eaf6b495f81ef9c5f6e68883a3a2750 wallet: refactor: dedup sqlite statement preparations (Sebastian Falbesoner) Pull request description: This refactoring PR deduplicates repeated SQLite statement preparation calls (`sqlite3_prepare_v2(...)`) / deletions (`sqlite3_finalize(...)`) and its surrounding logic by putting each prepared statement and its corresponding text representation into a ~std::map~ ~`std::array`~ `std::vector`. This should be more readable and less error-prone, e.g. in case an additional statement needs to be added in the future or the error handling has to be adapted. ACKs for top commit: achow101: ACK ea19cc844e780b29825b26aee321204be981a3ae meshcollider: utACK ea19cc844e780b29825b26aee321204be981a3ae Tree-SHA512: ced89869b2147e088e7a4cda2acbbdd4a806f66dbc2d6999953d0d702c0655aa53c0eb699cc7e5e3732f2d24206d577a9d9e1b5de7f439100dead2696ade1092
2021-04-07test: increase listbanned unit test coverageJon Atack
Add test coverage for the new ban_duration and time_remaining fields. While here, some code improvements.
2021-04-07Merge #21582: Fix assumeutxo crash due to missing base_blockhashMarcoFalke
fa9b74f5ea89624e052934c48391b5076a87ffef Fix assumeutxo crash due to missing base_blockhash (MarcoFalke) fa8fffebe8ac126f31143619843dd6578a2f4e3c refactor: Prefer clean assert over UB in coinstats (MarcoFalke) Pull request description: This fixes an UB (which results in a crash with sanitizers enabled). Can be reproduced by cherry-picking the test without the other code changes. The fix: * Adds an `Assert` to transform the UB into a clean crash, even when sanitizers are disabled * Adds an early-fail condition to avoid the crash ACKs for top commit: jamesob: ACK fa9b74f5ea89624e052934c48391b5076a87ffef ([`jamesob/ackr/21582.1.MarcoFalke.fix_assumeutxo_crash_due`](https://github.com/jamesob/bitcoin/tree/ackr/21582.1.MarcoFalke.fix_assumeutxo_crash_due)) ryanofsky: Code review ACK fa9b74f5ea89624e052934c48391b5076a87ffef with no code changes since last review, just splitting up combocommit a little. Tree-SHA512: dd36808a09f49c647543a9eaa6fdb785b3f1109af48ba4cc983153b22a144da9ca61af22034dcfaa0e192a65b1ee7de744f187555079aff55bec0efa0ce87cd4
2021-04-07Merge #21166: Introduce DeferredSignatureChecker and have ↵fanquake
SignatureExtractorClass subclass it a97a9298cea085858e1a65a5e9b20d7a9e0f7303 Test that signrawtx works when a signed CSV and CLTV inputs are present (Andrew Chow) 6965456c10c9c4025c71c5e24fa5b27b15e5933a Introduce DeferringSignatureChecker and inherit with SignatureExtractor (Andrew Chow) Pull request description: Previously SignatureExtractorChecker took a MutableTransactionSignatureChecker and passed through function calls to that. However not all functions were implemented so not everything passed through as it should have. To solve this, SignatureExctractorChecker now implements all of those functions via a new class - DeferredSignatureChecker. DeferredSignatureChecker is introduced to allow for future signature checkers which use another SignatureChecker but need to be able to do somethings outside of just the signature checking. Fixes #21151 ACKs for top commit: sipa: utACK a97a9298cea085858e1a65a5e9b20d7a9e0f7303 meshcollider: Code review ACK a97a9298cea085858e1a65a5e9b20d7a9e0f7303 instagibbs: utACK a97a9298cea085858e1a65a5e9b20d7a9e0f7303 Tree-SHA512: bca784c75c2fc3fcb74e81f4e3ff516699e8debaa2db81e12843abdfe9cf265dac11db8619751cb9b3e9bbe779805d029fabe5f3cbca5e86bfd72de3664b0b94
2021-04-06rpc: add time_remaining field to listbannedJarol Rodriguez
2021-04-06rpc: add ban_duration field to listbannedJarol Rodriguez
2021-04-06doc: improve listbanned helpJarol Rodriguez
Add descriptions for the address, ban_created, and banned_until fields.
2021-04-06rpc: swap position of banned_until and ban_created fieldsJarol Rodriguez
A ban expires after its creation. Therefore, for the listbanned RPC, position banned_until after ban_created in help and output.
2021-04-06fuzz: Fix uninitialized read in testMarcoFalke
2021-04-06Merge #21560: net: Add Tor v3 hardcoded seedsW. J. van der Laan
b2ee8b207de78f03356905bd60b7b00b6f49c252 net: Deserialize hardcoded seeds from BIP155 blob (W. J. van der Laan) 9b29d5df7fc555eaea42029f334f2995c6ccde3d contrib: Add explicit port numbers for testnet seeds (W. J. van der Laan) 2a257de113fd31539b68c28c47ef94f257b6e427 contrib: Add a few TorV3 seed nodes (W. J. van der Laan) 06030f7a42dea33c5120504dcd99d1714883f271 contrib: generate-seeds.py generates output in BIP155 format (W. J. van der Laan) Pull request description: Closes #20239 and mitigates my node's problem in #21351. - Add a few hardcoded seeds for TorV3 - As the [bitcoin-seeder](https://github.com/sipa/bitcoin-seeder) doesn't collect TorV3 addresses yet, I have extracted these from my own node using [a script](https://gist.github.com/laanwj/b3d7b01ef61ce07c2eff0a72a6b90183) and added them manually. This is intended to be a temporary stop gap until 22.0's seeds update. - Change hardcoded seeds to variable length BIP155 binary format. - It is stored as a single serialized blob in a byte array, instead of pseudo-IPv6 address slots. This is more flexible and, assuming most of the list is IPv4, more compact. - Only the (networkID, addr, port) subset (CService). Services and time are construed on the fly as before. - Change input format for `nodes_*.txt`. - Drop legacy `0xAABBCCDD` format for IPv4. It is never generated by `makeseeds.py`. - Stop interpreting lack of port as default port, interpret it as 'no port', to accomodate I2P and other port-less protocols (not handled in this PR). An explicit port is always generated by `makeseeds.py` so in practice this makes no difference right now. A follow-up to this PR could do the same for I2P. ACKs for top commit: jonatack: ACK b2ee8b207de78f03356905bd60b7b00b6f49c252 Tree-SHA512: 11a6b54f9fb0192560f2bd7b218f798f86c1abe01d1bf37f734cb88b91848124beb2de801ca4e6f856e9946aea5dc3ee16b0dbb9863799e42eec1b239d40d59d
2021-04-06Merge #21571: test: make sure non-IP peers get discouraged and disconnected ↵MarcoFalke
(vasild) 81747b21719b3fa6b0fdfc3b084c0104d64903f9 test: make sure non-IP peers get discouraged and disconnected (Vasil Dimov) 637bb6da368b87711005b909f451f94909400092 test: also check disconnect in denialofservice_tests/peer_discouragement (Vasil Dimov) 4d6e246fa46f2309e2998b542e4c104d73d29071 test: use pointers in denialofservice_tests/peer_discouragement (Vasil Dimov) Pull request description: Split up from #20966, so that it can be backported easier. Merging this ahead of #20966 will also reduce the number of conflicts for that pull. ACKs for top commit: jonatack: ACK 81747b21719b3fa6b0fdfc3b084c0104d64903f9 Tree-SHA512: 8f0e30b95baba7f056920d7fc3b37bd49ee13e69392fe80e2d333c6bb09fd25f4603249301b8795cca26a2f2d15b9f8904798a55cd9c04fd28afb316e95c551c
2021-04-06doc: fixup -Wdocumentation issuesfanquake
2021-04-06Merge #21557: test: small cleanup in RPCNestedTests testsMarcoFalke
6526a1644cd1723e47054aa83b3ae8eacf84bf84 test: small cleanup in RPCNestedTests tests (fanquake) Pull request description: Remove QtDir & QtGlobal (dea086f498097d19a2c9acbfc753c9c2d68dbb03) Add missing includes. Remove obsolete comment about Qt 5.3 (fd46c4c0018c41d36cd892ccb47485b572d65837) Top commit has no ACKs. Tree-SHA512: 097e603fc31a19be1817459ad4c5a9692708f8a39a0ae87e4a60eabc22bf4f6141b577ba68746044fd594f92e36848b7cd56d60dccd262f83f8ec7310ab7d1bc
2021-04-06Merge #21598: refactor: Remove negative lock annotations from globalsMarcoFalke
fa5eabe72117f6e3704858e8d5b2c57a120258ed refactor: Remove negative lock annotations from globals (MarcoFalke) Pull request description: They only make sense for mutexes that are private members. Until cs_main is a private member the negative annotations should be replaced by excluded annotations, which are optional. ACKs for top commit: sipa: utACK fa5eabe72117f6e3704858e8d5b2c57a120258ed ajtowns: ACK fa5eabe72117f6e3704858e8d5b2c57a120258ed hebasto: ACK fa5eabe72117f6e3704858e8d5b2c57a120258ed vasild: ACK fa5eabe72117f6e3704858e8d5b2c57a120258ed Tree-SHA512: 06f8a200304f81533010efcc42d9f59b8c4d0ae355920c0a28efb6fa161a3e3e68f2dfffb0c009afd9c2501e6a293c6e5a419a64d718f1f4e79668ab2ab1fcdc
2021-04-05build: Remove spaces from variable-printing rulesCarl Dong
This simplifies parsing when using these rules from scripts.
2021-04-05Merge #21302: wallet: createwallet examples for descriptor walletsW. J. van der Laan
5039e0e55a7c9dd63a38c12fa60d244592de69e0 test: HelpExampleCliNamed and HelpExampleRpcNamed (Ivan Metlushko) 591735ef0bf13b94643b794518406f981fa5dcb7 rpc: Add HelpExampleCliNamed and use it for `createwallet` doc (Wladimir J. van der Laan) 5d5a90e819d23a302f9bec6b995a3116ead6ae94 rpc: Add HelpExampleRpcNamed (Ivan Metlushko) Pull request description: Rationale: make descriptor wallets more visible and just a bit easier to setup `bitcoin-cli help createwallet` **Before**: ``` Examples: > bitcoin-cli createwallet "testwallet" > curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "createwallet", "params": ["testwallet"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ ``` **After** ``` Examples: > bitcoin-cli createwallet "testwallet" > curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "createwallet", "params": ["testwallet"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ > bitcoin-cli createwallet "descriptors" false false "" true true true > curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "createwallet", "params": ["descriptors", false, false, "", true, true, true]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ ``` ACKs for top commit: laanwj: Tested ACK 5039e0e55a7c9dd63a38c12fa60d244592de69e0 Tree-SHA512: d37210e6ce639addee881377092d8f6fb2a537a60a259c561899e24cf68a0254d7ff45a213573c938f626677e46770cd21113aae5974f26c66b9a2e137699c14
2021-04-05net: Deserialize hardcoded seeds from BIP155 blobW. J. van der Laan
Switch from IPv6 slot-based format to more compact and flexible BIP155 format.
2021-04-05refactor: Remove negative lock annotations from globalsMarcoFalke
2021-04-04Fix assumeutxo crash due to missing base_blockhashMarcoFalke
2021-04-04refactor: Prefer clean assert over UB in coinstatsMarcoFalke
2021-04-03Merge #20459: rpc: Fail to return undocumented return valuesMarcoFalke
fa8192f42e1d24444f1d0433c96dbce1adf76967 rpc: Fail to return undocumented return values (MarcoFalke) Pull request description: Currently a few return values are undocumented. This is causing confusion at the least. See for example #18476 Fix this by treating it as an internal bug to return undocumented return values. ACKs for top commit: ryanofsky: Code review ACK fa8192f42e1d24444f1d0433c96dbce1adf76967. Only changes: rebase, no const_cast suggestion, and tostring cleanups needed after suggestion Tree-SHA512: c006905639bafe3045de152b00c34d9864731becb3c4f468bdd61a392f10d7e7cd89a54862c8daa8c11ac4eea0eb5f13b0f647d21e21a0a797b54191cff7238c
2021-04-02Fix wrong wallet RPC context set after #21366Russell Yanofsky
This bug doesn't have any effects currently because it only affects external signer RPCs which aren't currently using the wallet context, but it does cause an appveyor failure in a upcoming PR: https://ci.appveyor.com/project/DrahtBot/bitcoin/builds/38512882 This bug is subtle and could have been avoided if JSONRPCRequest didn't have constructors that were so loose with type checking. Suggested change https://github.com/bitcoin/bitcoin/pull/21366#issuecomment-792044351 eliminates these and would be a good followup for a future PR.
2021-04-02test: make sure non-IP peers get discouraged and disconnectedVasil Dimov
2021-04-02test: also check disconnect in denialofservice_tests/peer_discouragementVasil Dimov
Use `CConnmanTest` instead of `CConnman` and add the nodes to it so that their `fDisconnect` flag is set during disconnection.
2021-04-02test: use pointers in denialofservice_tests/peer_discouragementVasil Dimov
This is a non-functional change that replaces the `CNode` on-stack variables with `CNode` pointers. The reason for this is that it would allow us to add those `CNode`s to `CConnman::vNodes[]` which in turn would allow us to check that they are disconnected properly - a `CNode` object must be in `CConnman::vNodes[]` in order for its `fDisconnect` flag to be set. If we store pointers to the on-stack variables in `CConnman` then it would crash at the end, trying to `delete` them.
2021-04-02wallet: refactor: dedup sqlite statement deletionsSebastian Falbesoner