aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2022-04-26Merge bitcoin/bitcoin#24157: p2p: Replace RecursiveMutex `cs_totalBytesSent` ↵laanwj
with Mutex and rename it 709af67add93f6674fb80e3ae8e3f175653a62f0 p2p: replace RecursiveMutex `m_total_bytes_sent_mutex` with Mutex (w0xlt) 8be75fd0f0039eeea5f9af7c1eb17c584ed9f507 p2p: add assertions and negative TS annotations for `m_total_bytes_sent_mutex` (w0xlt) a237a065cc2c6337e3797cc30a0f84c56c6d2f3b scripted-diff: rename cs_totalBytesSent -> m_total_bytes_sent_mutex (w0xlt) Pull request description: Related to #19303, this PR gets rid of the RecursiveMutex `cs_totalBytesSent` and also adds `AssertLockNotHeld` macros combined with `LOCKS_EXCLUDED` thread safety annotations to avoid recursive locking. ACKs for top commit: jonatack: ACK 709af67add93f6674fb80e3ae8e3f175653a62f0 per `git range-diff 7a4ac71 eff7918 709af67`, rebase to master, clang 15 debug build, and build with -Wthread-safety-negative vasild: ACK 709af67add93f6674fb80e3ae8e3f175653a62f0 hebasto: ACK 709af67add93f6674fb80e3ae8e3f175653a62f0, tested on Ubuntu 22.04. Tree-SHA512: 560b4e6c92b1511911d69185207df6ee809db09b96d97f96430d8d2595dc05c98cc691aaec8a58ef87cf2ab0a98675c210b8ce0be3dedb81e31114bbbfdfd8be
2022-04-25[tests] Move TxOrphange tests to orphange_tests.cppJohn Newbery
2022-04-24Merge bitcoin/bitcoin#24812: util/check: Add CHECK_NONFATAL identity ↵MarcoFalke
function and NONFATAL_UNREACHABLE macro ee02c8bd9aedad8cfd3c2618035fe275da025fb9 util/check: Add CHECK_NONFATAL identity function, NONFATAL_UNREACHABLE AND UNREACHABLE macros (Aurèle Oulès) Pull request description: This PR replaces the macro `CHECK_NONFATAL` with an identity function. I simplified the usage of `CHECK_NONFATAL` where applicable in `src/rpc`. This function is useful in sanity checks for RPC and command-line interfaces. Context: https://github.com/bitcoin/bitcoin/pull/24804#discussion_r846182474. Also adds `UNREACHABLE_NONFATAL` macro. ACKs for top commit: jonatack: ACK ee02c8bd9aedad8cfd3c2618035fe275da025fb9 MarcoFalke: ACK ee02c8bd9aedad8cfd3c2618035fe275da025fb9 🍨 Tree-SHA512: 3cba09223cd7b22e62fe5d0b46c4a024c1d9957d4268ba6d3fb07fcc0a5854fc0886bb3266184e6a7df5df91373b3e84edd6adf6999c4e934aeef8c043b01aa2
2022-04-22Merge bitcoin-core/gui#587: refactor: Replace `GUIUtil::ObjectInvoke()` with ↵Hennadii Stepanov
`QMetaObject::invokeMethod()` 6958a26aa136e0976870237ccc6ea015d113f7ac Revert "qt: Add ObjectInvoke template function" (Hennadii Stepanov) 249984f4f93fe6fae81391f474e4d64ad9df3d6d qt: Replace `GUIUtil::ObjectInvoke()` with `QMetaObject::invokeMethod()` (Hennadii Stepanov) Pull request description: A comment in 5659e73493fcdfb5d0cb9d686c24c4fbe1c217ed states that `GUIUtil::ObjectInvoke` > can be replaced by a call to the QMetaObject::invokeMethod functor overload after Qt 5.10 ACKs for top commit: w0xlt: tACK https://github.com/bitcoin-core/gui/pull/587/commits/6958a26aa136e0976870237ccc6ea015d113f7ac on Ubuntu 21.10, Qt 5.15.2. promag: Code review ACK 6958a26aa136e0976870237ccc6ea015d113f7ac. Tree-SHA512: 6a840289568113cf38df6c1092821d626c2d206768a21d4dc6846b9dcccb4130477adb45ba718bb6bc15a3041871a7df3238983ac03db80406732be597693266
2022-04-22Merge bitcoin/bitcoin#22910: net: Encapsulate asmap in NetGroupManagerfanquake
36f814c0e84d009c0e0aa26981a20ac4cf338a85 [netgroupman] Remove NetGroupManager::GetAsmap() (John Newbery) 4709fc2019e27e74be02dc5fc123b9f6f46d7990 [netgroupman] Move asmap checksum calculation to NetGroupManager (John Newbery) 1b978a7e8c71dcc1501705022e66f6779c8c4528 [netgroupman] Move GetMappedAS() and GetGroup() logic to NetGroupManager (John Newbery) ddb4101e6377a998b7c598bf52217b47698ddec9 [net] Only use public CNetAddr functions and data in GetMappedAS() and GetGroup() (John Newbery) 6b2268162e96bc4fe1a3ebad454996b1d3d4615c [netgroupman] Add GetMappedAS() and GetGroup() (John Newbery) 19431560e3e1124979c60f39eca9429c4a0df29f [net] Move asmap into NetGroupManager (John Newbery) 17c24d458042229e00dd4e0b75a32e593be29564 [init] Add netgroupman to node.context (John Newbery) 9b3836710b8160d212aacd56154938e5bb4b26b7 [build] Add netgroup.cpp|h (John Newbery) Pull request description: The asmap data is currently owned by addrman, but is used by both addrman and connman. #22791 made the data const and private (so that it can't be updated by other components), but it is still passed out of addrman as a reference to const, and used by `CNetAddress` to calculate the group and AS of the net address. This RFC PR proposes to move all asmap data and logic into a new `NetGroupManager` component. This is initialized at startup, and the client components addrman and connman simply call `NetGroupManager::GetGroup(const CAddress&)` and `NetGroupManager::GetMappedAS(const CAddress&)` to get the net group and AS of an address. ACKs for top commit: mzumsande: Code Review ACK 36f814c0e84d009c0e0aa26981a20ac4cf338a85 jnewbery: CI failure seems spurious. I rebased onto latest master to trigger a new CI run, but whilst I was doing that, mzumsande ACKed https://github.com/bitcoin/bitcoin/commit/36f814c0e84d009c0e0aa26981a20ac4cf338a85, so I've reverted to that. dergoegge: Code review ACK 36f814c0e84d009c0e0aa26981a20ac4cf338a85 Tree-SHA512: 244a89cdfd720d8cce679eae5b7951e1b46b37835fccb6bdfa362856761bb110e79e263a6eeee8246140890f3bee2850e9baa7bc14a388a588e0e29b9d275175
2022-04-22p2p: replace RecursiveMutex `m_total_bytes_sent_mutex` with Mutexw0xlt
2022-04-22p2p: add assertions and negative TS annotations for `m_total_bytes_sent_mutex`w0xlt
Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
2022-04-21Merge bitcoin/bitcoin#24854: Remove not needed ArithToUint256 roundtrips in ↵laanwj
tests fad6d4f952373690ef16ce27b0926c0ab762066a Remove not needed ArithToUint256 roundtrips in tests (MarcoFalke) fa456ccb2287b2a1a4eb7224b424f12fe59302e9 Remove duplicate static_asserts (MarcoFalke) Pull request description: No need to go from `arith_uint256`->`uint256` when a `uint256` can be constructed right away. ACKs for top commit: laanwj: Code review ACK fad6d4f952373690ef16ce27b0926c0ab762066a Tree-SHA512: bea901ea5904bf61a0dadf7168c6b126f7e62ff1180d4aa72063c28930a01a8baa57ab0d324226bd4de72fb59559455c29c049d90061f888044198aae1426dcb
2022-04-21Merge bitcoin/bitcoin#24213: refactor: use Span in random.*laanwj
3ae7791bcaa88f5c68592673b8926ee807242ce7 refactor: use Span in random.* (pasta) Pull request description: ~This PR does two things~ 1. use a Span<unsigned char> for GetRandBytes and GetStrongRandBytes ~2. make GetRand a template for which any integral type can be used, where the default behavior is to return a random integral up to the max of the integral unless a max is provided. This simplifies a lot of code from `GetRand(std::numeric_limits<uint64_t>::max()` -> `GetRand<uint64_t>()`~ MarcoFalke this was inspired by your comment here: https://github.com/bitcoin/bitcoin/pull/24185#issuecomment-1025514263 about using Span, so hopefully I'll be able to get this PR done and merged 😂 ~Also, if requested I could revert the `GetRand(std::numeric_limits<uint64_t>::max()` -> `GetRand<uint64_t>()` related changes if it ends up causing too many conflicts~ ACKs for top commit: laanwj: Thank you! Code review re-ACK 3ae7791bcaa88f5c68592673b8926ee807242ce7 Tree-SHA512: 12375a83b68b288916ba0de81cfcab4aac14389a66a36811ae850427435eb67dd55e47df9ac3ec47db4e214f4330139e548bec815fff8a3f571484ea558dca79
2022-04-20[netgroupman] Remove NetGroupManager::GetAsmap()John Newbery
asmap no longer needs to be exposed anywhere outside NetGroupManager.
2022-04-20[netgroupman] Move asmap checksum calculation to NetGroupManagerJohn Newbery
2022-04-20[netgroupman] Move GetMappedAS() and GetGroup() logic to NetGroupManagerJohn Newbery
Reviewer hint: use: `git diff --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space`
2022-04-20[net] Only use public CNetAddr functions and data in GetMappedAS() and ↵John Newbery
GetGroup() Also change parameter/variable names. This makes the next commit mostly move-only.
2022-04-20[netgroupman] Add GetMappedAS() and GetGroup()John Newbery
These currently call through to the CNetAddr methods. The logic will be moved in a future commit.
2022-04-20[net] Move asmap into NetGroupManagerJohn Newbery
2022-04-20Merge bitcoin/bitcoin#24909: refactor: Move and rename `pindexBestHeader`, ↵MarcoFalke
`fHavePruned` f0a2fb3c5dbf3c4bec7faf934baff3e723734b3f scripted-diff: Rename pindexBestHeader, fHavePruned (Carl Dong) a4014021258319941716d6338c18667462a06280 Clear fHavePruned in BlockManager::Unload() (Carl Dong) 3308ecd3fc254ee4ef9f803c09f00ba4dc968520 move-mostly: Make fHavePruned a BlockMan member (Carl Dong) c96524113c48553c4bbad63077a25494eca8159e Clear pindexBestHeader in ChainstateManager::Unload() (Carl Dong) 73eedaaacc3b5f2dd791997109f2f5312a894336 style-only: Miscellaneous whitespace changes (Carl Dong) 0d567daf23c9fcb2d95b38913ee45a8b0ba3b027 move-mostly: Make pindexBestHeader a ChainMan member (Carl Dong) 5d670173a32ccdcb25d3a6bf97317f0ac774e0ed validation: Load pindexBestHeader in ChainMan (Carl Dong) Pull request description: Split off from #22564 per Marco's suggestion: https://github.com/bitcoin/bitcoin/pull/22564#issuecomment-1100011503 This is basically the move-mostly parts of #22564. The overall intent is to move mutable globals manually reset by `::UnloadBlockIndex` into appropriate structs such that they are cleared at the appropriate times. Please read #22564's description for more rationale. In summary , this PR moves: 1. `pindexBestHeader` -> `ChainstateManager::m_best_header` 2. `fHavePruned` -> `BlockManager::m_have_pruned` ACKs for top commit: ajtowns: ACK f0a2fb3c5dbf3c4bec7faf934baff3e723734b3f -- code review only MarcoFalke: kirby ACK f0a2fb3c5dbf3c4bec7faf934baff3e723734b3f 😋 Tree-SHA512: 8d161701af81af1ff42da1b22a6bef2f8626e8642146bc9c3b27f3a7cd24f4d691910a2392b188ae058fec0611a17304dd73f60da695f53832d327f73d2fc963
2022-04-19scripted-diff: Rename pindexBestHeader, fHavePrunedCarl Dong
...to m_best_header and m_have_pruned -BEGIN VERIFY SCRIPT- find_regex="\bpindexBestHeader\b" \ && git grep -l -E "$find_regex" -- src \ | xargs sed -i -E "s@$find_regex@m_best_header@g" find_regex="\bfHavePruned\b" \ && git grep -l -E "$find_regex" -- src \ | xargs sed -i -E "s@$find_regex@m_have_pruned@g" -END VERIFY SCRIPT-
2022-04-19Clear fHavePruned in BlockManager::Unload()Carl Dong
----- Code Reviewer Notes Call graph of relevant functions: UnloadBlockIndex() <-- Moved from calls ChainstateManager::Unload() which calls BlockManager::Unload() <-- Moved to So calling UnloadBlockIndex() would still run this moved code. The code will also now run when ~BlockManager gets called, which makes sense.
2022-04-19move-mostly: Make fHavePruned a BlockMan memberCarl Dong
[META] In the next commit, we move the clearing of fHavePruned to BlockManager::Unload()
2022-04-19Clear pindexBestHeader in ChainstateManager::Unload()Carl Dong
----- Code Reviewer Notes Call graph of relevant functions: UnloadBlockIndex() <-- Moved from calls ChainstateManager::Unload() <-- Moved to Safe because ChainstateManager::Unload() is called only by UnloadBlockIndex() and no other callers.
2022-04-19style-only: Miscellaneous whitespace changesCarl Dong
...of touched lines and surrounding
2022-04-19move-mostly: Make pindexBestHeader a ChainMan memberCarl Dong
[META] In the next commit, we move the clearing of pindexBestHeader to ChainstateManager::Unload()
2022-04-19Merge bitcoin-core/gui#584: Getting ready to Qt 6 (5/n). Do not assume ↵Hennadii Stepanov
`qDBusRegisterMetaType` return type 6cf4dc7f64b42cbbff6a2ce7616ee625a87a29f5 qt: Do not assume `qDBusRegisterMetaType` return type (Hennadii Stepanov) Pull request description: `qDBusRegisterMetaType` returns: - [`int`](https://doc.qt.io/qt-5/qdbusargument.html#qDBusRegisterMetaType) in Qt 5 - [`QMetaType`](https://doc.qt.io/qt-6/qdbusargument.html#qDBusRegisterMetaType) in Qt 6 ACKs for top commit: laanwj: Anyhow code review ACK 6cf4dc7f64b42cbbff6a2ce7616ee625a87a29f5 w0xlt: tACK https://github.com/bitcoin-core/gui/pull/584/commits/6cf4dc7f64b42cbbff6a2ce7616ee625a87a29f5 on Ubuntu 21.10, Qt 5.15.2. Tree-SHA512: 17d43e191d31a6f927d19550c52471ed3b9222f492a23cee2e553f2c679cf37125e00637b00ea9f4ee3e37dfcf5278171be9a5e1e2e899592516291c7b5cd942
2022-04-19Merge bitcoin-core/gui#580: Getting ready to Qt 6 (3/n). Do not use ↵Hennadii Stepanov
`QKeyEvent` copy constructor 3ec6504a2e5b4afb7a2719a82191e0b96fe23214 qt: Do not use `QKeyEvent` copy constructor (Hennadii Stepanov) Pull request description: This PR is preparation for [Qt 6](https://github.com/bitcoin/bitcoin/pull/24798), and it fixes an experimental build with Qt 6.2.4 as copying of `QEvent` has been [disabled](https://github.com/qt/qtbase/commit/19f9b0d5f54379151eb71e98555b203ad6756276) in Qt 6.0.0. ACKs for top commit: w0xlt: tACK https://github.com/bitcoin-core/gui/pull/580/commits/3ec6504a2e5b4afb7a2719a82191e0b96fe23214 on Ubuntu 21.10, Qt 5.15.2 shaavan: reACK 3ec6504a2e5b4afb7a2719a82191e0b96fe23214 Tree-SHA512: 583a9dad0c621d9f02f77ccaa9f55ee79e12e3c47f418911ef2dfe0de357d772d1928ae3ec19b6f0c0674da858bab9d4542a26cc14b06ed921370dfeabd1c194
2022-04-19Merge bitcoin/bitcoin#24906: miniscript: the 'd:' wrapper must not be 'u'Andrew Chow
74175941870347458ba8a0074f88b22cb94d0235 miniscript: the 'd:' wrapper must not be 'u' (Antoine Poinsot) Pull request description: The type system was incorrectly relying on a standardness rule to be sound. This bug was found and reported by Andrew Poelstra [based on a question from Aman Kumar Kashyap](https://github.com/rust-bitcoin/rust-miniscript/discussions/341). ACKs for top commit: sipa: ACK 74175941870347458ba8a0074f88b22cb94d0235 apoelstra: utACK 74175941870347458ba8a0074f88b22cb94d0235 achow101: ACK 74175941870347458ba8a0074f88b22cb94d0235 Tree-SHA512: af68c1df1c40e40dd105ef54544c226f560524dd8e35248fa0305dbef966e96ec1fa6ff2fe50fb8f2792ac310761a29c55ea81dd7b6d122a0de0a68b135e5aaa
2022-04-19Merge bitcoin/bitcoin#24357: refactor: make setsockopt() and ↵laanwj
SetSocketNoDelay() mockable/testable a2c4a7acd1dfb2fb7e3c9dac6b3d8c9354b2e0a6 net: use Sock::SetSockOpt() instead of standalone SetSocketNoDelay() (Vasil Dimov) d65b6c3fb9cdd41fa53bc76a7b8f49aaa089b0bc net: use Sock::SetSockOpt() instead of setsockopt() (Vasil Dimov) 184e56d6683d05fc84f5153cfff83a2e32883556 net: add new method Sock::SetSockOpt() that wraps setsockopt() (Vasil Dimov) Pull request description: _This is a piece of #21878, chopped off to ease review._ Add a `virtual` (thus mockable) method `Sock::SetSockOpt()` that wraps the system `setsockopt()`. Convert the standalone `SetSocketNoDelay()` function to a `virtual` (thus mockable) method `Sock::SetNoDelay()`. This will help avoid syscalls during testing and to mock them to return whatever is suitable for the tests. ACKs for top commit: laanwj: Code review ACK a2c4a7acd1dfb2fb7e3c9dac6b3d8c9354b2e0a6 jonatack: ACK a2c4a7acd1dfb2fb7e3c9dac6b3d8c9354b2e0a6 change since last review is folding `Sock::SetNoDelay()` into the callers Tree-SHA512: 3e2b016c1e4128317a28c17dc9b30472949e1ac3b071b2697c6d30cbcc830df1ee4392a4e23b2ea1ab4e3fb0f59ef450e2a4f3c1df3d8c803dd081652b6c7387
2022-04-19Merge bitcoin/bitcoin#24772: refactor: Use [[maybe_unused]] attributelaanwj
07ddecb84e6097684fa56cfc79c8c2aad76f6604 refactor: Use [[maybe_unused]] attribute (Hennadii Stepanov) 55e0fc8df9c4045453982888732a0dd7c99ea6d1 refactor: Drop unneeded workarounds aimed to silence unused warning (Hennadii Stepanov) Pull request description: This change is required for bitcoin/bitcoin#24773 as it prevents MSVC yelling about "warning C4551: function call missing argument list". But it is useful by itself as it makes code more concise and readable. ACKs for top commit: Empact: Code review ACK 07ddecb84e6097684fa56cfc79c8c2aad76f6604 laanwj: Code review ACK 07ddecb84e6097684fa56cfc79c8c2aad76f6604 vincenzopalazzo: ACK https://github.com/bitcoin/bitcoin/pull/24772/commits/07ddecb84e6097684fa56cfc79c8c2aad76f6604 w0xlt: ACK 07ddecb Tree-SHA512: 01791855a9ba742202d5718203303af989fcb501b7cf2a24ac8d78e87487acca38f77bef264b8e27e41ad1ccf96e426725cf65bfd96ce2ac71c46b3792bed857
2022-04-19Merge bitcoin/bitcoin#24871: refactor: Simplify GetTimefanquake
0000a63689036dc4368d04c0648a55fdf507932f Simplify GetTime (MarcoFalke) Pull request description: The implementation of `GetTime` is confusing: * The value returned by `GetTime` is assumed to be equal to `GetTime<std::chrono::seconds>()`. Both are mockable and the only difference is return type, the value itself is equal. However, the implementation does not support this assumption. * On some systems, `time_t` might be a signed 32-bit integer (https://en.cppreference.com/w/c/chrono/time), thus breaking in the year 2038, whereas `GetTime<std::chrono::seconds>` does not. Also, `time_t` might be `-1` "on error", where "error" is unspecified. * `GetTime<std::chrono::seconds>` calls `GetTimeMicros`, which calls `GetSystemTime`, which calls `std::chrono::system_clock::now`, which doesn't have the above issues. See https://en.cppreference.com/w/cpp/chrono/system_clock/now * `GetTimeMicros` and the internal-only `GetSystemTime` will likely be renamed (to clarify they are the non-mockable non-monotonic system time) or removed in the future to be replaced by appropriate `std::chrono::time_point<Clock>` getters. Fix all issues by: * making `GetTime()` an alias for `GetTime<std::chrono::seconds>().count()`. * inlining the needed parts of `GetSystemTime` directly instead of needlessly increasing the function call stack with functions that are likely to be removed in the future. ACKs for top commit: martinus: Code review, untested ACK 0000a63689036dc4368d04c0648a55fdf507932f. By the way strictly speaking `std::chrono::system_clock` is only guaranteed to be based on the unix epoch starting with C++20: https://en.cppreference.com/w/cpp/chrono/system_clock theStack: Code-review ACK 0000a63689036dc4368d04c0648a55fdf507932f Tree-SHA512: f751ba740e0da65537be800e9414dd02282d9f04c0b0fb986a36546f257d0b888d8688653cdda5d355ec832c0e09d866922d9161b1ccd33485c1c92c5d1e802f
2022-04-19Merge bitcoin/bitcoin#21279: scripted-diff: Regenerate key_io data ↵laanwj
deterministically fa506add25cbe5efbbabca647f5378c4128cf945 scripted-diff: Regenerate key_io data deterministically (MarcoFalke) fafb4796d34548e9037148e07bdf6fb770dd5427 contrib: make gen_key_io_test_vectors deterministic (MarcoFalke) Pull request description: ACKs for top commit: Sjors: ACK fa506add25cbe5efbbabca647f5378c4128cf945 laanwj: Tested ACK fa506add25cbe5efbbabca647f5378c4128cf945 Tree-SHA512: 02dc56c70c53356ee8d7012b42bec56017d646790f3248fd7437b6be556903ae9511abf3803fa30c7a11c10b4e9d41a736ff927404059bcdf2e0f30b70553014
2022-04-19[init] Add netgroupman to node.contextJohn Newbery
This is constructed before addrman and connman, and destructed afterwards. netgroupman does not currently do anything, but will have functionality added in future commits.
2022-04-19[build] Add netgroup.cpp|hJohn Newbery
These aren't used yet.
2022-04-18bench: Add a benchmark for wallet loadingAndrew Chow
2022-04-18scripted-diff: rename cs_totalBytesSent -> m_total_bytes_sent_mutexw0xlt
-BEGIN VERIFY SCRIPT- sed -i 's/cs_totalBytesSent/m_total_bytes_sent_mutex/g' -- $(git grep --files-with-matches 'cs_totalBytesSent') -END VERIFY SCRIPT-
2022-04-18Merge bitcoin/bitcoin#24859: wallet: Change wallet validation orderAndrew Chow
6f29409ad180ef00998ac05997f0fa03f98cd066 test: Add a test that creates a wallet with invalid parameters (w0xlt) 0359d9b6a3808e70af6e19b85d13371eb0434ce5 Change wallet validation order (w0xlt) Pull request description: In the current code, the database is created before the last validation, which checks that passphrase is set and private keys are disabled. Therefore, if this validation fails, it will result in an empty database and the user will not be able to recreate a wallet with the same name and with the correct parameters. Behavior on the master branch: ``` $ ./src/bitcoin-cli -regtest -named createwallet wallet_name="invalid_wallet_01" disable_private_keys=true passphrase="passphrase" error code: -4 error message: Passphrase provided but private keys are disabled. A passphrase is only used to encrypt private keys, so cannot be used for wallets with private keys disabled. $ ./src/bitcoin-cli -regtest -named createwallet wallet_name="invalid_wallet_01" error code: -4 error message: Wallet file verification failed. Failed to create database path '/home/w/.bitcoin/regtest/wallets/invalid_wallet'. Database already exists. ``` Behavior on the PR branch: ``` $ ./src/bitcoin-cli -regtest -named createwallet wallet_name="invalid_wallet_02" disable_private_keys=true passphrase="passphrase" error code: -4 error message: Passphrase provided but private keys are disabled. A passphrase is only used to encrypt private keys, so cannot be used for wallets with private keys disabled. $ ./src/bitcoin-cli -regtest -named createwallet wallet_name="invalid_wallet_02" { "name": "invalid_wallet_01", "warning": "" } ``` ACKs for top commit: achow101: ACK 6f29409ad180ef00998ac05997f0fa03f98cd066 Tree-SHA512: d192955fc2285bf27ae5dd4c1b7cfd3d85441a7f3554b189b974aefb319c6b997543991dbb0ca2c8cb980f7058913a77cf0164c02e9b51ceb9c2cb601317c428
2022-04-18miniscript: the 'd:' wrapper must not be 'u'Antoine Poinsot
The value it leaves on the stack depends on the last element on the stack. However, we can't make sure this element is OP_1 (which would give us the 'u' property) without the MINIMALIF rule. MINIMALIF is only policy for P2WSH, therefore giving 'd:' the 'u' property breaks consensus soundness: it makes it possible (by consensus but not policy) for instance to satisfy a thresh() without satisfying at least k of its subs. This bug was found and reported by Andrew Poelstra.
2022-04-17Merge bitcoin/bitcoin#24837: init: Prevent -noproxy and -proxy=0 from ↵MarcoFalke
interacting with other settings 3429d67014095b42a976d95c3ef8622d5fe085e6 init: Prevent -noproxy and -proxy=0 settings from interacting with other settings (Ryan Ofsky) Pull request description: Prevent `-noproxy` and `-proxy=0` settings from interacting with `-listen`, `-upnp`, and `-natpmp` settings. These settings started being handled inconsistently in the `AppInitMain` and `InitParameterInteraction` functions starting in commit baf05075fae2cc2625a2a74b35cc66902f3cbfa3 from #6272: https://github.com/bitcoin/bitcoin/blob/baf05075fae2cc2625a2a74b35cc66902f3cbfa3/src/init.cpp#L990-L991 https://github.com/bitcoin/bitcoin/blob/baf05075fae2cc2625a2a74b35cc66902f3cbfa3/src/init.cpp#L687 This commit changes both functions to handle proxy arguments the same way so there are not side effects from specifying a proxy=0 setting. This change was originally part of #24830 but really is independent and makes more sense as a separate PR ACKs for top commit: hebasto: ACK 3429d67014095b42a976d95c3ef8622d5fe085e6, tested on Ubuntu 22.04. Tree-SHA512: c4c6b4aeb3c07321700e974c16fd47a1bd3d469f273a6b308a69638db81c88c4e67208fddc96fcda9c8bd85f3ae22c98ca131c9622895edaa34eb65c194f35db
2022-04-16Revert "qt: Add ObjectInvoke template function"Hennadii Stepanov
This reverts commit 5659e73493fcdfb5d0cb9d686c24c4fbe1c217ed.
2022-04-16qt: Replace `GUIUtil::ObjectInvoke()` with `QMetaObject::invokeMethod()`Hennadii Stepanov
The `GUIUtil::ObjectInvoke()` template function was a replacement of the `QMetaObject::invokeMethod()` functor overload which is available in Qt 5.10+. No behavior change.
2022-04-16util/check: Add CHECK_NONFATAL identity function, NONFATAL_UNREACHABLE AND ↵Aurèle Oulès
UNREACHABLE macros
2022-04-16Simplify GetTimeMarcoFalke
2022-04-16Merge bitcoin/bitcoin#24855: rpc: Fix `setwalletflag` disabling of flagsfanquake
88376c623cff3602d04ec6c94a89552aefa20fa7 test: Test for disabling wallet flags (Andrew Chow) 17ab31aa46f7b5c265d07091fe45671ef2af6a9a rpc, wallet: setwalletflags warnings are optional (Andrew Chow) Pull request description: Trying to disable a wallet flag with `setwalletflag` results in `Internal bug detected: 'std::any_of(m_results.m_results.begin(), m_results.m_results.end(), [ret](const RPCResult& res) { return res.MatchesType(ret); })'`. This occurs because the `warnings` field was not marked as optional. This PR makes `warnings` optional to avoid this error. Also added a test case because apparently we didn't already have one. ACKs for top commit: w0xlt: ACK 88376c6 Tree-SHA512: 4f5d3bebf0d022a5ad0f75d70c6562a43c7da6e39e9c3118733327d015c435e2c8d5004fdb039d42407dde5b21231a0f8827623d718abf611a1f06c15af5c806
2022-04-16Merge bitcoin/bitcoin#24841: test: fix connman UB by calling derived constructorMarcoFalke
c848a45101b4dbd750739e7a6e5bdeec79920273 test: fix connman UB by calling derived constructor (chinggg) Pull request description: Hopefully closes #24373 by calling `ConnmanTestMsg` test-constructor to avoid undefined behavior in process_message.cpp after casting `g_setup->m_node.connman`. Top commit has no ACKs. Tree-SHA512: c3dce9dcce33614c7b739edf28e416b600ab3d38d16cdb0430490e8ffc9b64aff9292006ae6fe7c636ab0627893bb21f69435893bdfb129a9a865be92baa6f17
2022-04-16test: fix connman UB by calling derived constructorchinggg
2022-04-15Merge bitcoin-core/gui#579: Getting ready to Qt 6 (2/n). Remove ↵Hennadii Stepanov
`QApplication::globalStrut()` 3eaf5dbfe0a0c814116e92f602f3c062259b6ea3 qt: Remove `QApplication::globalStrut()` call (Hennadii Stepanov) Pull request description: This function has been deprecated in Qt 5.15.0, and has been [removed](https://github.com/qt/qtbase/commit/033d01bd6e2aef740ad1408a04d3ca0ae3b9ba9b) in Qt 6. ACKs for top commit: jarolrod: ACK 3eaf5dbfe0a0c814116e92f602f3c062259b6ea3 luke-jr: utACK 3eaf5dbfe0a0c814116e92f602f3c062259b6ea3 Tree-SHA512: 71ee539b6ffa3755f7e6beaa72a8937886471e298830878def6dd9f48c601611d94d52c638bc1602f938df2ba84ff8b130ea8da8e6c08ae7146173fa613a5003
2022-04-15Merge bitcoin-core/gui#556: refactor: Make BitcoinUnits::Unit a scoped enumHennadii Stepanov
0e5dedbc9eb54105ab9b0c4ce1f57afa55bcb5b6 qt/wallettests: sort includes (William Casarin) 0554251d660caa1c3f5f44ae1d9fa3c23d2aac18 qt: Skip displayUnitChanged signal if unit is not actually changed (Hennadii Stepanov) ffbc2fe459034024cb2fce9fd94bff457b7a7d49 qt, refactor: Remove default cases for scoped enum (Hennadii Stepanov) 152d5bad50f145af922011f6ec1fd9afd9076ceb qt, refactor: Remove BitcoinUnits::valid function (Hennadii Stepanov) aa23960fdf1deff321ecea435026c87db78498fb qt, refactor: Make BitcoinUnits::Unit a scoped enum (Hennadii Stepanov) 75832fdc37ea3fe9cf515bd1946e220fe07a440b qt: Use QVariant instead of int for BitcoinUnit in QSettings (Hennadii Stepanov) Pull request description: This is a rebased version of #60 Since Qt 5.5 there are [means](https://doc.qt.io/qt-5/qobject.html#Q_ENUM) to register an enum type with the meta-object system (such enum still lacks an ability to interact with [QSettings::setValue()](https://doc.qt.io/qt-5/qsettings.html#setValue) and [QSettings::value()](https://doc.qt.io/qt-5/qsettings.html#value) without defined stream operators). In order to reduce global namespace polluting and to force strong type checking, this PR makes BitcoinUnits::Unit a scoped enum (typedef BitcoinUnits::Unit BitcoinUnit;). No behavior change. ACKs for top commit: jonatack: ACK 0e5dedbc9eb54105ab9b0c4ce1f57afa55bcb5b6, review and debug build of each commit after rebase on current master, lightly tested running the GUI, changing units a few times, and verifying persistence after restarting promag: Code review ACK 0e5dedbc9eb54105ab9b0c4ce1f57afa55bcb5b6 Tree-SHA512: 39ec0d7e4f0b9b25be287888121a8db6b282339674e37ec3a3554da63a9e22d6fe079e8310ca289b2a0356a19b3c7e55afa17d09dd34e0f222177f603bb053a3
2022-04-15Merge bitcoin-core/gui#552: Refactor `TransactionDesc::FormatTxStatus` and ` ↵Hennadii Stepanov
TransactionStatus` 343f83d0886ae39c9dacb29762ce712711b2bad2 qt, refactor: Use member initializers in TransactionStatus (w0xlt) 66d58ad7a99a98b5e78fd97ddf777ea00e6091cf qt, refactor: remove unused field `qint64 TransactionStatus::open_for` (w0xlt) ad6adedb46e25870bcdabeca93c51c3ac2a33de7 qt, refactor: remove unused parameters in `TransactionDesc::FormatTxStatus()` (w0xlt) 045f8d0310d2340aa32db6f7e582dea45950d28a scripted-diff: rename nDepth -> depth (w0xlt) b1bc1431db1e86eefaf4a91e08663628d94656fc qt, refactor: remove redundant scope in `TransactionDesc::FormatTxStatus()` (w0xlt) Pull request description: This PR implements the changes suggested in https://github.com/bitcoin-core/gui/issues/538#issuecomment-1021913294 . . remove redundant scope, rename `nDepth` -> `depth`, remove unused parameters and add translator comments in `TransactionDesc::FormatTxStatus()` . Use member initializers and remove unused field `qint64 TransactionStatus::open_for` in `TransactionStatus`. Closes https://github.com/bitcoin-core/gui/issues/538 ACKs for top commit: hebasto: ACK 343f83d0886ae39c9dacb29762ce712711b2bad2, I have reviewed the code and it looks OK, I agree it can be merged. jarolrod: Code Review ACK https://github.com/bitcoin-core/gui/commit/343f83d0886ae39c9dacb29762ce712711b2bad2 Tree-SHA512: cc7333d85b7eb731aa8cdd2d8dfc707341532c93e1b5e3858e8341446cf055ba055b601f9662e8d4602726b1bedf13149c46256a60a0ce1a562f94c9986d945a
2022-04-15net: use Sock::SetSockOpt() instead of standalone SetSocketNoDelay()Vasil Dimov
Since the former is mockable, this makes it easier to test higher level code that sets the TCP_NODELAY flag.
2022-04-15net: use Sock::SetSockOpt() instead of setsockopt()Vasil Dimov
2022-04-15net: add new method Sock::SetSockOpt() that wraps setsockopt()Vasil Dimov
This will help to increase `Sock` usage and make more code mockable.
2022-04-15Change wallet validation orderw0xlt
In the current code, the database is created before the last validation, which checks that passphrase is set and private keys are disabled. Therefore, if this validation fails, it will result in an empty database and the user will not be able to recreate a wallet with the same name and with the correct parameters.