Commit Graph

15652 Commits

Author SHA1 Message Date
Odysseas Gabrielides
85d6cadbfa
feat!: v19 BIP9 fork (#5070)
* Added v19 HF

* Refactoring

* Update src/consensus/params.h

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-11-22 11:34:21 -06:00
Odysseas Gabrielides
06dfe1bd1f
feat(rpc): Added quorum listextended RPC (#5076)
* Added quorum listextended

* Indentation fix

* Added release notes

* Added quorum listextended func test

* Refactored reply into map

* fix: change type from ARR to OBJ_DYN to properly print out the placeholder

Co-authored-by: pasta <pasta@dashboost.org>
2022-11-21 12:17:28 -06:00
Kittywhiskers Van Gogh
17dcbdd77a
revert: merge bitcoin#15454 (Remove the automatic creation and loading of the default wallet)
reverts b71ee6cbee
2022-11-08 11:54:11 -06:00
pasta
f6ea1a9f03
revert: merge bitcoin#20186 (Make -wallet setting not create wallets)
reverts f27ef79e4c
2022-11-08 11:54:10 -06:00
Kittywhiskers Van Gogh
5261a4733a
refactor: create context for LLMQ subsystem within NodeContext, alias entangled globals (#5030)
* llmq: move initialization logic to 'LLMQContext', add unique pointer to NodeContext

* llmq: add aliases to LLMQ globals, expose them to RPC via LLMQContext

* rpc: replace most global invocations with LLMQContext aliases

* rpc: replace quorum RPC global invocations with LLMQContext aliases

* llmq: replace individual global member arguments with context pointer

* llmq: pass aliased context pointer instead of individual globals in tests

* llmq: move BLS worker to LLMQContext, remove global

* llmq: move DKG debug manager to LLMQContext, remove global

* llmq: move DKG session manager to LLMQContext, remove global

* llmq: move quorum share manager to LLMQContext, remove global

* llmq: move quorum signing manager to LLMQContext, remove global
2022-11-07 21:09:44 +03:00
Kittywhiskers Van Gogh
0c0716fa03 merge bitcoin#20323: Create or use existing properly initialized NodeContexts 2022-11-07 22:46:23 +05:30
UdjinM6
083c86040f
fix: params cleanup in pow_tests/get_next_work (#5067) 2022-11-02 10:30:09 -05:00
UdjinM6
468769f9ff
fix: do not crash when running with statsenabled=1 (#5066) 2022-11-01 00:30:54 -05:00
Kittywhiskers Van Gogh
8c07349a49 merge bitcoin#16251: Improve signrawtransaction error reporting 2022-11-01 00:28:53 -05:00
Kittywhiskers Van Gogh
4dbb95316a merge bitcoin#18416: Limit decimal range of numbers ParseScript accepts 2022-11-01 00:28:53 -05:00
Kittywhiskers Van Gogh
8542752296 merge bitcoin#20429: replace (sizeof(a)/sizeof(a[0])) with C++17 std::size
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-11-01 00:28:53 -05:00
Kittywhiskers Van Gogh
8133469746 merge bitcoin#20457: Make Parse{Int,UInt}{32,64} use locale independent std::from_chars(…) (C++17) instead of locale dependent strto{l,ll,ul,ull} 2022-11-01 00:28:53 -05:00
Kittywhiskers Van Gogh
55e1853d65 merge bitcoin#21328: pass uint16 CService::port as uint16 2022-11-01 00:28:53 -05:00
Kittywhiskers Van Gogh
138ad4f9bf merge bitcoin#21444: Doxygen updates and fixes in netbase.{h,cpp} 2022-11-01 00:28:53 -05:00
Kittywhiskers Van Gogh
e28c1c3f1b merge bitcoin#19415: Make DNS lookup mockable, add fuzzing harness 2022-11-01 00:28:53 -05:00
Kittywhiskers Van Gogh
9a9bd217ad merge bitcoin#19203: Add regression fuzz harness for CVE-2017-18350. Add FuzzedSocket 2022-11-01 00:28:53 -05:00
Kittywhiskers Van Gogh
ba90fb6338 merge bitcoin#20812: Bump FuzzedDataProvider.h 2022-11-01 00:28:53 -05:00
Kittywhiskers Van Gogh
f6b2a1722a merge bitcoin#20788: add RAII socket and use it instead of bare SOCKET 2022-11-01 00:28:53 -05:00
Kittywhiskers Van Gogh
1fb1f0d86f partial bitcoin#18638: Use mockable time for ping/pong, add tests 2022-11-01 00:28:53 -05:00
PastaPastaPasta
aaa5c7967d
refactor: change Process* functions from accepting a ptr to a reference (#5062)
also drops an almost always unneeded string
converts some std::strings to std::string_view
also drops an unneeded param
2022-10-28 22:50:54 +03:00
UdjinM6
e04b31cb9a
fix: make masternodeSync available as early as possible (#5060) 2022-10-25 07:42:48 +03:00
PastaPastaPasta
90bb674ac0
refactor: use util/irange.h in block_reward_reallocation_tests.cpp (#5061) 2022-10-24 00:05:22 +03:00
PastaPastaPasta
88adf2402f
refactor: introduce a python-like enumerate() method, and use it in block_reward_reallocation_tests.cpp 2022-10-24 00:00:17 +03:00
Kittywhiskers Van Gogh
32a328cae3
refactor: replace util::Ref with CoreContext (std::variant) (#5055)
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-10-22 12:18:03 -05:00
Kittywhiskers Van Gogh
835f2baf86 refactor: remove leftover rpc prefix from filename (evo, quorum) 2022-10-21 21:51:45 +05:30
Kittywhiskers Van Gogh
1f7c2353a9 refactor: resolve implicit-const-int-float-conversion warning in statsd_client 2022-10-21 21:51:35 +05:30
Kittywhiskers Van Gogh
ce90b10402 fix(coinjoin): fix version comparison check serialization bug 2022-10-21 21:44:41 +05:30
Kittywhiskers Van Gogh
f5f41e5348 merge bitcoin#19314: Use uint16_t instead of unsigned short 2022-10-20 16:08:45 -05:00
Kittywhiskers Van Gogh
9e9e170bd6 merge bitcoin#20736: Replace boost::variant with std::variant for RPCArg.m_fallback 2022-10-20 16:08:45 -05:00
Kittywhiskers Van Gogh
76c8e8f2e8 merge bitcoin#20480: Replace boost::variant with std::variant 2022-10-20 16:08:45 -05:00
Kittywhiskers Van Gogh
3ef8b80abf merge bitcoin#20253: use std::chrono throughout maxOutbound logic 2022-10-20 16:08:45 -05:00
Kittywhiskers Van Gogh
41f8af2211 merge bitcoin#20602: Allow use of C++14 chrono literals 2022-10-20 16:08:45 -05:00
Kittywhiskers Van Gogh
dc85f86dbb merge bitcoin#19084: improve code documentation for dns seed behaviour 2022-10-20 16:08:45 -05:00
Kittywhiskers Van Gogh
40a80c0aff merge bitcoin#16939: Delay querying DNS seeds 2022-10-20 16:08:45 -05:00
Kittywhiskers Van Gogh
6851dbf908 merge bitcoin#21882: Fix undefined reference to __mulodi4 2022-10-20 16:08:45 -05:00
Kittywhiskers Van Gogh
41eba6beef merge bitcoin#21415: remove Optional & nullopt 2022-10-20 16:08:45 -05:00
Kittywhiskers Van Gogh
898fef5c01 merge bitcoin#21404: Remove MakeUnique<T>() 2022-10-20 16:08:45 -05:00
Odysseas Gabrielides
a99fe72cbe
refactor: restrict some llmq logging to only debug=llmq (#5050)
* llmq only logging

* llmq only logging

* style: reference on the left

* refactoring

* fix

* style: fix colon location in for loop

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2022-10-20 14:47:50 -05:00
Wladimir J. van der Laan
b0518f0796 Merge #17985: net: Remove forcerelay of rejected txs
facb71576cd4d2e90fd03e09d29b42fa3d730e8c net: Remove forcerelay of rejected txs (MarcoFalke)

Pull request description:

  This removes the code that supposedly handled the forced relay of txs from a permissioned peer that were rejected from our mempool. The removal should be fine, because it is dead code for the following reasons:

  * While `RelayTransaction` enqueues the inv for all peers, the inv is never processed because it can not be found in the mempool. See 4a07233076/src/net_processing.cpp (L3862-L3866)

  * Even if the peers we intended to send the inv to can somehow reply with a getdata to the never-received inv, they won't receive the tx as a reply because it was never added to the "relay memory" (`mapRelay`)

  The dead code is (obviously) untested: https://marcofalke.github.io/btc_cov/total.coverage/src/net_processing.cpp.gcov.html#2574

  This feature was (intentionally or accidentally) removed in 4d8993b346, which was released in Bitcoin Core 0.13.0. So all currently supported versions of Bitcoin Core ship without this feature. I am not aware of any complaints about this feature or actual documented use-cases. So instead of reviving an unneeded feature, just remove the dead code.

ACKs for top commit:
  hebasto:
    ACK facb71576cd4d2e90fd03e09d29b42fa3d730e8c, locally running the unit and functional tests.

Tree-SHA512: bfceae6f2983c1510fa0649a9a63c343cbbc1c4ab3a3698039cccf454c81e58c8f5114b147ed42a1bc867da74c43a5b53764ab14f942e191b6f59079044108b5
2022-10-20 11:48:21 -04:00
Wladimir J. van der Laan
bbaab7ca5c Merge #18167: Fix a violation of C++ standard rules where unions are used for type-punning
0653939ac130eddffe40c53ac418bea305d3bf82 Add static_asserts to ser_X_to_Y() methods (Samer Afach)
be94096dfb0c4862e2314cbae4120d7360b08ef2 Fix a violation of C++ standard rules that unions cannot be switched. (Samer Afach)

Pull request description:

  Type punning in C++ is not like C. As per the C++ standard, one cannot use unions to convert the bit type. A discussion about this can be found [here](https://stackoverflow.com/questions/25664848/unions-and-type-punning). In C++, a union is supposed to only hold one type at a time. It's intended to be used only as `std::variant`. Switching types is undefined behavior.

  In fact, C++20 has a special casting function, called [`bit_cast`](https://en.cppreference.com/w/cpp/numeric/bit_cast) that solved this problem.

  Why has it been working so far? Because some compilers tolerate using unions and switching types, like gcc. More information [here](https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#Type-punning).

  One important thing to mention is that performance is generally not affected by that memcpy. Compilers are smart enough to convert that to a memory cast when possible. But we have to do it the right way, otherwise, it's jut undefined behavior that depends on the compiler.

ACKs for top commit:
  practicalswift:
    ACK 0653939ac130eddffe40c53ac418bea305d3bf82
  elichai:
    ACK 0653939ac130eddffe40c53ac418bea305d3bf82
  laanwj:
    Code review ACK 0653939ac130eddffe40c53ac418bea305d3bf82
  kristapsk:
    ACK 0653939ac130eddffe40c53ac418bea305d3bf82

Tree-SHA512: f6e89de39fc964750429139bab6b5a1346f7060334b7afa020e315bdad8f8c195bce2b8a9e343f06e7fff175e2dfb1cdabfcb6fe405bea0febe4962f0cc62557
2022-10-20 11:47:02 -04:00
Samuel Dobson
9fc7ffaac9 Merge #17264: rpc: set default bip32derivs to true for psbt methods
5bad7921d0b33b62c0a59a478c2e8c869fc5e3b5 [test] PSBT RPC: check that bip32_derivs are present by default (Sjors Provoost)
29a21c90610aed88b796a7a5900e42e9048b990e [rpc] set default bip32derivs to true for psbt methods (Sjors Provoost)

Pull request description:

  In https://github.com/bitcoin/bitcoin/pull/13557#pullrequestreview-135905054 I recommended not including bip32 deriviation by default in PSBTs:

  > _Bit of a privacy issue_: let's say person A and B are about to spend from a multisig address, sending everything to person A. Person A gives their address to person B, their wallet wallet creates a PSBT, but doesn't sign it. Wallet A then calls `walletprocesspsbt` which signs it and _spontaneously adds the master_fingerprint and bip32 path_. Same issue with `walletcreatefundedpsbt`.
  >
  > Adding `bip32_derivs` should probably be opt-in.

  In practice I find this default quite annoying because I forget it and end up with a confused hardware wallet.

  More importantly, in the multisig example I provided, it's actually essential for the other side to know the derivation details (in addition to an xpub). This allows them to check that change is going to an address you can still co-sign for (because the spending policy is unchanged except for an index).

ACKs for top commit:
  instagibbs:
    utACK 5bad7921d0
  jonatack:
    ACK 5bad7921d0 code review, built, ran tests, inspected/messed around with/pprinted values from the new tests. Thanks for adding the tests.
  meshcollider:
    utACK 5bad7921d0b33b62c0a59a478c2e8c869fc5e3b5

Tree-SHA512: 22ad71dda96856060a96758c4ae7aafa22d5e9efba30e0c8287c711e7579849bd72593cbc0f41a2e9e8821315d78bda04e848dbb006283b841b2795e2faebcfd
2022-10-20 11:47:02 -04:00
fanquake
02aac6b0f8 Merge #18162: util: Avoid potential uninitialized read in FormatISO8601DateTime(int64_t) by checking gmtime_s/gmtime_r return value
12a2f377185a413b740460db36812de22ee2e041 util: Avoid potential uninitialized read in FormatISO8601DateTime(int64_t nTime) by checking gmtime_s/gmtime_r return value (practicalswift)

Pull request description:

  Avoid potential uninitialized read in `FormatISO8601DateTime(int64_t)` by checking `gmtime_s`/`gmtime_r` return value.

  Before this patch `FormatISO8601DateTime(67768036191676800)` resulted in:

  ```
  ==5930== Conditional jump or move depends on uninitialised value(s)
  ==5930==    at 0x4F44C0A: std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_int<long>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, long) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
  ==5930==    by 0x4F511A4: std::ostream& std::ostream::_M_insert<long>(long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
  ==5930==    by 0x4037C3: void tinyformat::formatValue<int>(std::ostream&, char const*, char const*, int, int const&) (tinyformat.h:358)
  ==5930==    by 0x403725: void tinyformat::detail::FormatArg::formatImpl<int>(std::ostream&, char const*, char const*, int, void const*) (tinyformat.h:543)
  ==5930==    by 0x402E02: tinyformat::detail::FormatArg::format(std::ostream&, char const*, char const*, int) const (tinyformat.h:528)
  ==5930==    by 0x401B16: tinyformat::detail::formatImpl(std::ostream&, char const*, tinyformat::detail::FormatArg const*, int) (tinyformat.h:907)
  ==5930==    by 0x4017AE: tinyformat::vformat(std::ostream&, char const*, tinyformat::FormatList const&) (tinyformat.h:1054)
  ==5930==    by 0x401765: void tinyformat::format<int, int, int, int, int, int>(std::ostream&, char const*, int const&, int const&, int const&, int const&, int const&, int const&) (tinyformat.h:1064)
  ==5930==    by 0x401656: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > tinyformat::format<int, int, int, int, int, int>(char const*, int const&, int const&, int const&, int const&, int const&, int const&) (tinyformat.h:1073)
  ==5930==    by 0x4014CC: FormatISO8601DateTime[abi:cxx11](long) (…)
  ```

  The same goes for other very large positive and negative arguments.

  Fix by simply checking the `gmtime_s`/`gmtime_r` return value :)

ACKs for top commit:
  MarcoFalke:
    ACK 12a2f377185a413b740460db36812de22ee2e041
  theStack:
    re-ACK 12a2f37718
  elichai:
    re ACK 12a2f377185a413b740460db36812de22ee2e041

Tree-SHA512: 066142670d9bf0944d41fa3f3c702b1a460b5471b93e76a619b1e818ff9bb9c09fe14c4c37e9536a04c99533f7f21d1b08ac141e1b829ff87ee54c80d0e61d48
2022-10-20 11:47:02 -04:00
MarcoFalke
352744d222 Merge #18193: scripted-diff: Wallet: Rename incorrectly named *UsedDestination
bca8665d0895c450e552c357a036d9e9579e3678 scripted-diff: Wallet: Rename incorrectly named *UsedDestination (Luke Dashjr)

Pull request description:

  These functions are used to mark/check if a key of our own has been used to spend (and only for avoid-reuse wallets), which has nothing to do with the destination/address itself.
  Give them more accurate names to avoid confusion.

  -BEGIN VERIFY SCRIPT-
  sed -i -e 's/UsedDestination/SpentKey/g' $(git grep -l 'UsedDestination' ./src)
  -END VERIFY SCRIPT-

ACKs for top commit:
  practicalswift:
    ACK bca8665d0895c450e552c357a036d9e9579e3678 -- patch looks correct and rationale makes sense
  instagibbs:
    ACK bca8665d08, much more meaningful name, thanks
  kallewoof:
    ACK bca8665d0895c450e552c357a036d9e9579e3678

Tree-SHA512: ff13d9061ffa748e92eb41ba962c3ec262a43e4b6abd62408b38c6f650395d6ae5851554257d1900fb02767a88d08380d592a27210192ee9abb72d0945976686
2022-10-20 11:47:02 -04:00
PastaPastaPasta
2fbf76368b
Refactor: minor misc coinjoin refactoring (#5053)
* refactor: add more [[nodiscard]]

* refactor: drop unneeded .get()

* refactor: use functional style int cast

* refactor: use std::numeric_limits::max()

* refactor: use GetRand instead of GetRandInt
2022-10-19 21:43:33 +03:00
PastaPastaPasta
ad660554aa
refactor/fix: use the shared_ptr<CWallet> where possible instead of getting the underlying pointer (#5052)
* refactor/fix: use the shared_ptr<CWallet> where possible instead of getting the underlying pointer

This is also a fix in regards to the rpcevo.cpp file where the old code could result in a dangling pointer that could result in a crash as the shared_ptr we get back is discarded while the underlying ptr is still being used

* refactor: remove unneeded line

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-10-19 21:42:40 +03:00
PastaPastaPasta
f4bb06985f
refactor: use std::optional in some spork code (#4736)
* refactor: use std::optional in some spork code

* fix: return std::nullopt
2022-10-19 21:37:28 +03:00
PastaPastaPasta
ad88fab80d
test/refactor: upgrade to cppcheck 2.9 and fix warnings (#5049)
* refactor: resolve warnings thrown by cppcheck 2.9

* test: upgrade cppcheck to version 2.9
2022-10-18 13:24:00 +03:00
UdjinM6
3ff6bd13df
Merge branch 'master' into merge_master_18.1.0 2022-10-17 23:47:08 +03:00
MeshCollider
ccfe4b76c6 Merge #16239: wallet/rpc: follow-up clean-up/fixes to avoid_reuse
71d0344cf25d3aaf60112c5248198c444bc98105 docs: release note wording (Karl-Johan Alm)
3d2ff379131a01e4e9f9648b150e806104a23795 wallet/rpc: use static help text (Karl-Johan Alm)
53c3c1ea9e20f881c843a9219e48cec202e962f8 wallet/rpc/getbalances: add entry for 'mine.used' balance in results (Karl-Johan Alm)

Pull request description:

  This addresses a few remaining issues pointed out in #13756:

  * First commit addresses https://github.com/bitcoin/bitcoin/pull/13756#discussion_r284907468
  * Second commit addresses https://github.com/bitcoin/bitcoin/pull/13756#discussion_r294868973

  Ping jnewbery and achow101 as they pointed out these issues.

ACKs for commit 71d034:
  jnewbery:
    ACK 71d0344cf25d3aaf60112c5248198c444bc98105
  meshcollider:
    re-utACK 71d0344cf2

Tree-SHA512: 5e28822af0574ad07dbbed21aa2fe7866bf5770b4c0a1c150ad0da8af3152bcfb7170330a7497fa500326c594740ecf63733cf58325821e2811d7b911d5783a0
2022-10-17 15:41:14 -05:00
Wladimir J. van der Laan
078094b2aa Merge #15930: rpc: Add balances RPC
facfb4111d14a3b06c46690a2cca7ca91cea8a96 rpc: Deprecate getunconfirmedbalance and getwalletinfo balances (MarcoFalke)
999931cf8f167c7547f1015cdf05437a460c27f0 rpc: Add getbalances RPC (MarcoFalke)
fad13e925e197163a942f3f0d1ba2c95a2b65a56 rpcwallet: Make helper methods const on CWallet (MarcoFalke)
fad40ec9151248c6e8225e14980424f581d23e02 wallet: Use IsValidNumArgs in getwalletinfo rpc (MarcoFalke)

Pull request description:

  This exposes the `CWallet::GetBalance()` struct over RPC.

  In the future, incorrectly named rpcs such as `getunconfirmedbalance` or rpcs redundant to this such as `getbalance` could be removed.

ACKs for commit facfb4:
  jnewbery:
    utACK facfb4111d14a3b06c46690a2cca7ca91cea8a96

Tree-SHA512: 1f54fedce55df9a8ea82d2b6265354b39a956072621876ebaee2355aac0e23c7b64340c3279502415598c095858529e18b50789be956250aafda1cd3a8d948a5
2022-10-17 15:41:14 -05:00