Commit Graph

16395 Commits

Author SHA1 Message Date
MarcoFalke
2e8800cdc1 Merge #20686: fuzz, refactor: replace CNode code with fuzz/util.h::ConsumeNode()
23d8f346896c806581189c9eb870c7833c09f5be fuzz: replace CNode code with fuzz/util.h::ConsumeNode() (Jon Atack)

Pull request description:

  Noticed this while updating the CNode fuzzing in #20210.

  - cc26fab48d76a813d798657b18ae1af08a301150 created `test/fuzz/net.cpp` in May 2020

  - 79ef8324d4c85ed16a304e98805724b8a created a CNode factory utility `test/fuzz/util.h::ConsumeNode()` in October 2020

  This PR updates `fuzz/net.cpp` from the first commit to use `ConsumeNode()` from the second commit.

ACKs for top commit:
  MarcoFalke:
    ACK 23d8f346896c806581189c9eb870c7833c09f5be

Tree-SHA512: 26f7685395b3d48fcf40dde0d479d5c2fb4e953ec9371940b19eee16bb30aee4840b081e1a918b924a9704c1bef484302ea3e8fe63819a3bba73e7eb805164f1
2023-08-08 06:26:09 -05:00
Wladimir J. van der Laan
b1e0b6c1f5 Merge #20668: doc: warn that incoming conns are unlikely when not using default ports
010eed3ce03cf4fc622a48f40fc4d589383f7a44 doc: warn that incoming conns are unlikely when not using default ports (Adam Jonas)

Pull request description:

  Closes #5150.

  This was mostly copied from #5285 by sulks, who has since quit GitHub.

  The issue has remained open for 6 years, but the extra explanation still seems useful.

ACKs for top commit:
  laanwj:
    re-ACK 010eed3ce03cf4fc622a48f40fc4d589383f7a44

Tree-SHA512: d240fb06bba41ad8898ced59356c10adefc09f3abb33e277f8e2c5980b40678f2d237f286b476451bb29d2b94032a7dee2ada3b2efe004ed1c2509e70b48e40f
2023-08-08 06:26:09 -05:00
fanquake
2111c7727b Merge #20617: p2p: Remove m_is_manual_connection from CNodeState
a33442fdc73eabd1c5596ab92954344edc9517e6 Remove m_is_manual_connection from CNodeState (Antoine Riard)

Pull request description:

  Currently, this member is only used to exclude MANUAL peers from discouragement
  in MaybePunishNodeForBlock(). Manual connections are already protected in
  MaybeDiscourageAndDisconnect(), independently from their network
  processing behaviors.

ACKs for top commit:
  MarcoFalke:
    cr ACK a33442fdc73eabd1c5596ab92954344edc9517e6
  promag:
    Code review ACK a33442fdc73eabd1c5596ab92954344edc9517e6.
  jnewbery:
    utACK a33442fdc73eabd1c5596ab92954344edc9517e6
  amitiuttarwar:
    code review ACK a33442fdc73eabd1c5596ab92954344edc9517e6

Tree-SHA512: cfe3f3dfa131373e3299002d34ae9e22ca6e1a966831bab32fcf06ff1d08f06095b4ab020cc4d267f3ec05ae23fbdc22373382ab828b999c0db11b8c842a4f0c
2023-08-08 06:26:09 -05:00
Kittywhiskers Van Gogh
b92539f437 merge bitcoin#24132: Bump minimum Qt version to 5.11.3 2023-08-08 06:05:02 -05:00
Kittywhiskers Van Gogh
545387128c merge bitcoin#21286: Bump minimum Qt version to 5.9.5 2023-08-08 06:05:02 -05:00
Konstantin Akimov
93bd0c70a2
refactor: rename assetLockedAmount in CbTx to creditPoolBalance (#5526)
## Issue being fixed or feature implemented
Bad naming is noticed in https://github.com/dashpay/dash/pull/5026 by
thephez

## What was done?
Renamed `assetLockedAmount` in CbTx to `creditPoolBalance`
Renamed also some local variables and functions to make it matched also.

## How Has This Been Tested?
Run functional/unit tests - succeed
Called python's rpc binding `node.getblock(block_hash)['cbTx']`:
Got this result:
```
{'version': 3, 'height': 1556, 'merkleRootMNList': '978b2b4d1b884de62799b9eaee75c7812fea59f98f80d5ff9c963b0f0f195e14', 'merkleRootQuorums': 'bc7a34eb114f4e4bf38a11080b5d8ac41bdb36dd41e17467bae23c94ba06b013', 'bestCLHeightDiff': 0, 'bestCLSignature': '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', 'creditPoolBalance': Decimal('7.00141421')}
```

## Breaking Changes
Renamed `assetLockedAmount` in CbTx to `creditPoolBalance`. @shumkov be
informed


## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [x] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone
2023-08-08 05:49:31 -05:00
MarcoFalke
2c9d41d073 Merge #18454: net: Make addr relay mockable, add test
NOTE: There is slight difference with original backport due to future changes
in bitcoin#19272, bitcoin#19763 - otherwise functional test p2p_addr_relay.py fails

fa1da3d4bfc0511a89f5b19d5a4d89e55ff7ccde test: Add basic addr relay test (MarcoFalke)
fa1793c1c44a3f75a09f9c636467b8274c541bdd net: Pass connman const when relaying address (MarcoFalke)
fa47a0b003f53708b6d5df1ed4e7f8a7c68aa3ac net: Make addr relay mockable (MarcoFalke)

Pull request description:

  As usual:

  * Switch to std::chrono time to be type-safe and mockable
  * Add basic test that relies on mocktime to add code coverage

ACKs for top commit:
  naumenkogs:
    utACK  fa1da3d
  promag:
    ACK fa1da3d4bfc0511a89f5b19d5a4d89e55ff7ccde (fabe56e44b6f683e24e37246a7a8851190947cb3 before https://github.com/bitcoin/bitcoin/pull/18454#issuecomment-607866453), fa5bf23d527a450e72c2bf13d013e5393b664ca3 was dropped since last review.

Tree-SHA512: 0552bf8fcbe375baa3cab62acd8c23b2994efa47daff818ad1116d0ffaa0b9e520dc1bca2bbc68369b25584e85e54861fe6fd0968de4f503b95439c099df9bd7

fixup - see #19272, #19763
2023-08-03 11:16:41 -05:00
MarcoFalke
7c5f9af0dc Merge #18563: test: Fix unregister_all_during_call cleanup
13d2a33537a403ac47a989be92109d3214375b6a Fix unregister_all_during_call cleanup (Russell Yanofsky)

Pull request description:

  Use `TestingSetup` fixture to fix `unregister_all_during_call` test not calling `UnregisterBackgroundSignalScheduler`, which could trigger an assert in `RegisterBackgroundSignalScheduler` when called in later tests

  Failure reported by fanquake https://github.com/bitcoin/bitcoin/pull/18551#issuecomment-610974251

ACKs for top commit:
  MarcoFalke:
    ACK 13d2a33537a403ac47a989be92109d3214375b6a if appveyor unit tests pass

Tree-SHA512: d2ec8ff14c54d97903af50031abfac1f38ec1c3aabc90371cfd5b79481fa69d3d77f339bfdf7d2178fd85e83402f72eda7cf4d339e5bbfa7e6e1a68836643b93
2023-08-03 11:16:41 -05:00
MarcoFalke
560e5589cb Merge #18532: rpc: Avoid initialization-order-fiasco on static CRPCCommand tables
fa1a92224dd78de817d15bcda35a8310254e1a54 rpc: Avoid initialization-order-fiasco on static CRPCCommand tables (MarcoFalke)

Pull request description:

  Currently the fiasco is only theoretical because all content of the table are compile-time constants. However, the fiasco materializes should they ever become run-time constants (e.g. #18531).

ACKs for top commit:
  promag:
    ACK fa1a92224dd78de817d15bcda35a8310254e1a54.
  practicalswift:
    ACK fa1a92224dd78de817d15bcda35a8310254e1a54 -- fiasco bad :)

Tree-SHA512: cccadb0ad56194599b74f04264d74c34fa865958580a850efc6474bbdc56f30cadce6b2e9a6ad5472ff46c3f4c793366acd8090fad409a45b25d961f2d89da19
2023-08-03 11:16:41 -05:00
MarcoFalke
2046ae1bc0 Merge #18546: Bugfix: Wallet: Safely deal with change in the address book [part 2]
7a2ecf16df938dd95d3130a46082def7a02338eb Wallet: Change IsMine check in CWallet::DelAddressBook from assert to failure (Luke Dashjr)
2952c46b923042f2de801f319e03ed5c4c4eb735 Wallet: Replace CAddressBookData.name with GetLabel() method (Luke Dashjr)
d7092c392e10889cd7a080b3d22ed6446a59b87a QA: Test that change doesn't turn into non-change when spent in an avoid-reuse wallet (Luke Dashjr)

Pull request description:

  Follow-up to #18192, not strictly necessary for 0.20

ACKs for top commit:
  MarcoFalke:
    re-ACK 7a2ecf16df, only change is adding an assert_equal in the test 🔰
  jnewbery:
    utACK 7a2ecf16df938dd95d3130a46082def7a02338eb

Tree-SHA512: e0933ee40f705b751697dc27249e1868ed4874254b174ebdd0a7150125d8c818402e66df2371718c7eeb90e67ee2317215fb260aa9b9d7b9b45ee436de2988ff
2023-08-03 11:16:41 -05:00
Wladimir J. van der Laan
363b37dfbd Merge #18487: rpc: Fix rpcRunLater race in walletpassphrase
7b8e15728d1ad058a4b7d7569fd5d5ba6806ca28 rpc: Fix rpcRunLater race in walletpassphrase (João Barbosa)

Pull request description:

  Release locks before calling `rpcRunLater`.

  Quick explanation: `rpcRunLater` leads to `event_free` which calls `event_del` which can wait for the event callback to finish if it's already running and that callback will try to lock wallet mutex - which is already locked in http thread.

  Fixes #14995 , fixes #18482. Best reviewed with whitespace changes hidden.

ACKs for top commit:
  MarcoFalke:
    ACK 7b8e15728d, only tested that this avoids the node freezing. Did not look at how libevent works or how the deadlock happens or if this breaks other stuff. 📞
  ryanofsky:
    Code review ACK 7b8e15728d1ad058a4b7d7569fd5d5ba6806ca28. Just updated comment since last review

Tree-SHA512: 17874a2fa7b0e164fb0d7ee4cb7d59650275b8c03476fb291d60af8b758495457660d3912623fb26259fefe84aeba21c0a9e0c6467982ba511f19344ed5413ab
2023-08-03 11:16:41 -05:00
MarcoFalke
76242f9d8d Merge #18551: Do not clear validationinterface entries being executed
2276339a176f83ffe8ceefb3e41ecca8601aa13b Add test for UnregisterAllValidationInterfaces bug (Russell Yanofsky)
3c61abbbc847d725f30d169278d84655571407c1 Do not clear validationinterface entries being executed (Pieter Wuille)

Pull request description:

  The previous code for MainSignalsInstance::Clear would decrement the reference
  count of every interface, including ones that were already Unregister()ed but
  still being executed.

  This fixes the issue pointed out here: https://github.com/bitcoin/bitcoin/pull/18524/files#r404395685 . It's not currently observable.

ACKs for top commit:
  jonasschnelli:
    utACK 2276339a176f83ffe8ceefb3e41ecca8601aa13b - reviewed code and test (thanks @ryanofsky for adding the test).
  MarcoFalke:
    ACK 2276339a176f83ffe8ceefb3e41ecca8601aa13b 🎎
  ryanofsky:
    Code review ACK 2276339a176f83ffe8ceefb3e41ecca8601aa13b. No change to bugfix, just rebased and new test commit added since last review

Tree-SHA512: c1d68e7c681a45c6cadc84e407c2266bcb4b12d34264e1232a61c4eadb74b551231c5a3b1d041de39f507aef4dfa7d4589b8bfe1833f069c739c6270d2a05dbe
2023-08-03 11:16:41 -05:00
Wladimir J. van der Laan
d2bbf03c32 Merge #18524: refactor: drop boost::signals2 in validationinterface
d6815a2313158862d448733954a73520f223deb6 refactor: drop boost::signals2 in validationinterface (Russell Yanofsky)

Pull request description:

  Stop using boost::signals2 internally in validationinterface. Replace with std::list and Add/Remove/Clear/Iterate helper functions.

  Motivation for change is to reduce dependencies and avoid issues happening with boost versions before 1.59: https://github.com/bitcoin/bitcoin/issues/18517, https://github.com/bitcoin/bitcoin/pull/18471

ACKs for top commit:
  MarcoFalke:
    ACK d6815a2313158862d448733954a73520f223deb6
  laanwj:
    ACK d6815a2313158862d448733954a73520f223deb6
  hebasto:
    re-ACK d6815a2313158862d448733954a73520f223deb6
  promag:
    ACK d6815a2313158862d448733954a73520f223deb6.

Tree-SHA512: 4fc0f14a8446e8616cc142af6c3d36815f3254525d30348ba8e4d4bc74c249a5a8c9bc119bdd1be7ebd7abe0b784bc0c5551a3e156a766890cb2fdd891a95919
2023-08-03 11:16:41 -05:00
Konstantin Akimov
4f00d45e53 Merge #18587: gui: Avoid wallet tryGetBalances calls in WalletModel::pollBalanceChanged
d3a56be77a9d112cde4baef4314882170b9f228f Revert "gui: Avoid Wallet::GetBalance in WalletModel::pollBalanceChanged" (Russell Yanofsky)
bf0a510981ddc28c754881ca21c50ab18e5f2b59 gui: Avoid wallet tryGetBalances calls before TransactionChanged or BlockTip notifications (Russell Yanofsky)
2bc9b92ed8b7736ad67876398a0bb8287f57e9b3 Cancel wallet balance timer when shutdown requested (Russell Yanofsky)
83f69fab3a1ae97c5cff8ba1e6fd191b0fa264bb Switch transaction table to use wallet height not node height (Russell Yanofsky)

Pull request description:

  Main commit `gui: Avoid wallet tryGetBalances calls` is one-line change to `WalletModel::pollBalanceChanged` that returns early if there hasn't been a new `TransactionChanged` or `BlockTip` notification since the previous poll call. This is the same behavior that was implemented in #18160, now implemented in a simpler way.

  The other commits are a straight revert of #18160, and two tweaks to avoid relying on `WalletModel::m_client_model` lifetime which were causing travis failures with earlier versions of this PR.

  Motivation for this change is to be able to revert #18160 and cut down on unnecessary cross-process calls that happen when #18160 is combined with #10102

  This PR is part of the [process separation project](https://github.com/bitcoin/bitcoin/projects/10).# This is a combination of 2 commits.
2023-08-03 11:16:41 -05:00
Wladimir J. van der Laan
9a84f7ef76 Merge #18160: gui: Avoid Wallet::GetBalance in WalletModel::pollBalanceChanged
0933a37078e1ce3a3d70983c3e7f4b3ac6c3fa37 gui: Avoid Wallet::GetBalance in WalletModel::pollBalanceChanged (João Barbosa)

Pull request description:

  Each 250ms the slot `WalletModel::pollBalanceChanged` is called which, at worst case, calls `Wallet::GetBalance`. This is a waste of resources since most of the time there aren't new transactions or new blocks. Fix this by early checking if cache is dirty or not.

  The actual balance computation can still hang the GUI thread but that is tracked in #16874 and should be fixed with a solution similar to #17135.

ACKs for top commit:
  hebasto:
    ACK 0933a37078e1ce3a3d70983c3e7f4b3ac6c3fa37, I have not tested the code, but I have reviewed it and it looks OK, I agree it can be merged.
  jonasschnelli:
    utACK 0933a37078e1ce3a3d70983c3e7f4b3ac6c3fa37
  instagibbs:
    ACK 0933a37078e1ce3a3d70983c3e7f4b3ac6c3fa37
  ryanofsky:
    Code review ACK 0933a37078e1ce3a3d70983c3e7f4b3ac6c3fa37, but I would prefer (not strongly) for #17905 to be merged first. This PR can be simpler if it is based on #17905, so tryGetBalances can just be left alone instead of changing into to a more complicated tryGetBalancesIfNeeded function, and then getting changed back later when we want to optimize it out.
  jonatack:
    ACK 0933a37078e based primarily on code review, despite a lot of manual testing with a large 177MB wallet.

Tree-SHA512: 18db35bf33a7577666658c8cb0b57308c8474baa5ea95bf1468cd8531a69857d8915584f6ac505874717aa6aabeb1b506ac77630f8acdb6651afab89275e38a1
2023-08-03 11:16:41 -05:00
Kittywhiskers Van Gogh
cc9dcdd0e0 test: migrate TestChainSetup's g_txindex guardrails 2023-08-02 10:19:02 -05:00
Kittywhiskers Van Gogh
d7b7bbd425 merge bitcoin#27988: Use same timeout for all index sync 2023-08-02 10:19:02 -05:00
Kittywhiskers Van Gogh
a9e3b9f2db partial bitcoin#27405: Use steady clock instead of system clock to measure durations
includes:
- fa1d8044abc2cd0f149a2d526b3b03441443cdb0
2023-08-02 10:19:02 -05:00
Kittywhiskers Van Gogh
1e609cff61 util: add SteadyClock type alias to std::chrono::steady_clock
courtesy of c84390b from bitcoin#25487
2023-08-02 10:19:02 -05:00
Kittywhiskers Van Gogh
5b338c33da merge bitcoin#24921: Add time helpers for std::chrono::steady_clock and FastRandomContext::rand_uniform_delay 2023-08-02 10:19:02 -05:00
Kittywhiskers Van Gogh
c21f23db1b partial bitcoin#24138: Commit MuHash and best block together for coinstatsindex
excludes:
- 691d45fdc83ec14f87a400f548553168ac70263f (portions)
2023-08-02 10:19:02 -05:00
Kittywhiskers Van Gogh
6f270bbf9b merge bitcoin#24133: Improve robustness of coinstatsindex at restart 2023-08-02 10:19:02 -05:00
Kittywhiskers Van Gogh
123cf8d2c7 partial bitcoin#24117: make indices robust against init aborts
excludes:
- bfcd60f5d505334230013de4115483b22a7898ee
2023-08-02 10:19:02 -05:00
Kittywhiskers Van Gogh
4e9d9a69e8 merge bitcoin#21767: Prune g_chainman usage in auxiliary modules 2023-08-02 10:19:02 -05:00
Kittywhiskers Van Gogh
d577d8bc57 merge bitcoin#21796: Avoid async shutdown on init error 2023-08-02 10:19:02 -05:00
Kittywhiskers Van Gogh
d97dcb22e1 merge bitcoin#22047: Coinstatsindex follow-ups 2023-08-02 10:19:02 -05:00
Kittywhiskers Van Gogh
2235388bf8 index: send zero-value arguments if calculating subsidy of genesis block
Dash uses the height and difficulty of the previous block to calculate
the subsidy for the current block... which in the case of the genesis
block is block -1, which doesn't exist.

Attempting in reading `pprev` which is will evaluate to a `nullptr`, so
for any blocks <=0, we fetch the subsidy expected from block 0 from
CChainParams.
2023-08-02 10:19:02 -05:00
Kittywhiskers Van Gogh
040cd922f6 merge bitcoin#19521: Coinstats Index 2023-08-02 10:19:02 -05:00
Konstantin Akimov
d914bf2b6e
feat: add bloom filter for Asset Lock transactions (#5521)
## Issue being fixed or feature implemented
There's one type of output that potentially can be useful for bloom
filter.
It's follow-up for TODO for dashpay/dash#4857.

Asset  Lock transactions have:
 - standard inputs (covered by regular bloom filter implementation)
 - standard outputs (covered by regular bloom filter implementation)
- special outputs that have public key to proof owing this credits on
platform and claiming it.

Asset Unlock transactions have:
 - no inputs (no need bloom)
 - standard outputs (covered by regular bloom filter implementation)

So far as there's only one special case, let's have this data in the
bloom filter because it can potentially help to show information such as
"Deposit to platform" on mobile clients.

## What was done?
 - added special case for Asset Lock transactions for bloom filter

## How Has This Been Tested?
Run unit/functional tests. Doesn't actually tested how bloom filter
works.


## Breaking Changes
N/A

## Checklist:
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone

---------

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2023-08-02 10:08:39 -05:00
MarcoFalke
5b0e3b9f30 Merge #19832: p2p: Put disconnecting logs into BCLog::NET category
1816327e533d359c237c53eb6440b2f3a7cbf4fa p2p: Put disconnecting logs into BCLog::NET category (Hennadii Stepanov)

Pull request description:

  It's too noisy:
  ```
  $ cat debug.log | wc -l
  28529
  $ cat debug.log | grep "Disconnecting and discouraging peer" | wc -l
  10177
  ```

ACKs for top commit:
  MarcoFalke:
     noban, addnode and local peers are still unconditionally logged (as they should), but this one can go into a category, so cr-ACK 1816327e533d359c237c53eb6440b2f3a7cbf4fa
  practicalswift:
    ACK 1816327e533d359c237c53eb6440b2f3a7cbf4fa for the reasons MarcoFalke gave above.
  ajtowns:
    ACK 1816327e533d359c237c53eb6440b2f3a7cbf4fa

Tree-SHA512: c312c1009090840659b2cb1364d8ad9b6ab8e742fc462aef169996d93c76c248507639a00257ed9d73a6916c01176b1793491b2305e92fdded5f9de0935b6ba6
2023-08-01 12:24:36 -05:00
MarcoFalke
dbf605e1f9 (Partial) Merge #20566: refactor: Use C++17 std::array where possible
fac7ab1d5b58fb9cfd80d5cf74ac4d2e5cb8eff2 refactor: Use C++17 std::array where possible (MarcoFalke)

Pull request description:

  Using the C++11 std::array with explicit template parameters is problematic because overshooting the size will fill the memory with default constructed types.

  For example,

  ```cpp
  #include <array>
  #include <iostream>

  int main()
  {
      std::array<int, 3> a{1, 2};
      for (const auto& i : a) {
          std::cout << i << std::endl;  // prints "1 2 0"
      }
  }
  ```

ACKs for top commit:
  jonasschnelli:
    Code Review ACK fac7ab1d5b58fb9cfd80d5cf74ac4d2e5cb8eff2
  practicalswift:
    cr ACK fac7ab1d5b58fb9cfd80d5cf74ac4d2e5cb8eff2
  vasild:
    ACK fac7ab1d
  promag:
    Code review ACK fac7ab1d5b58fb9cfd80d5cf74ac4d2e5cb8eff2.

Tree-SHA512: ef7e872340226e0d6160e6fd66c6ca78b2ef9c245fa0ab27fe4777aac9fba8d5aaa154da3d27b65dec39a6a63d07f1063c3a8ffb667a98ab137756a1a0af2656
2023-08-01 12:24:36 -05:00
Wladimir J. van der Laan
84b8d62d34 Merge #20221: net: compat.h related cleanup
cadb77a6ab8a3e6f56062cfaec4dd8168c71b39d net: Add compat.h header for htonl function (Hennadii Stepanov)
f796f0057bc7dad8e7065831b07f432fc0fb9f08 net: Drop unneeded headers when compat.h included (Hennadii Stepanov)
467c34644861a5267601255650e27c7aadab31dc net: Drop unneeded Windows headers in compat.h (Hennadii Stepanov)

Pull request description:

  It is the `compat.h` header's job to provide platform-agnostic interfaces for internet operations.
  No need in `#include <arpa/inet.h>` scattered around.

ACKs for top commit:
  practicalswift:
    re-ACK cadb77a6ab8a3e6f56062cfaec4dd8168c71b39d: patch looks even better
  laanwj:
    Code review ACK cadb77a6ab8a3e6f56062cfaec4dd8168c71b39d

Tree-SHA512: 625ff90b2806310ab856a6ca1ddb6d9a85aa70f342b323e8525a711dd12219a1ecec8373ec1dca5a0653ffb11f9b421753887b25615d991ba3132c1cca6a3c6e
2023-08-01 12:24:36 -05:00
fanquake
de28a0e10c Merge #20530: lint, refactor: Update cppcheck linter to c++17 and improve explicit usage
1e62350ca20898189904a88dfef9ea11ddcd8626 refactor: Improve use of explicit keyword (Fabian Jahr)
c502a6dbfb854ca827a5a3925394f9e09d29b898 lint: Use c++17 std in cppcheck linter (Fabian Jahr)

Pull request description:

  I found the `extended-lint-cppcheck` linter still uses `std=c++11` when reviewing #20471. The only difference in the output after this change is one line is missing:

  ```
  src/script/descriptor.cpp:159:5: warning: Struct 'PubkeyProvider' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
  ```

  After some digging, I am still not sure why this one is ignored with c++17 when 40 other`noExplicitConstructor` warnings were still appearing.

  In the second commit, I fix these warnings, adding `explicit` where appropriate and adding fixes to ignore otherwise.

ACKs for top commit:
  practicalswift:
    cr ACK 1e62350ca20898189904a88dfef9ea11ddcd8626: patch looks correct!
  MarcoFalke:
    review ACK 1e62350ca20898189904a88dfef9ea11ddcd8626

Tree-SHA512: dff7b324429a57160e217cf38d9ddbb6e70c6cb3d3e3e0bd4013d88e07afc2292c3df94d0acf7122e9d486322821682ecf15c8f2724a78667764c05d47f89a12
2023-08-01 12:24:36 -05:00
Wladimir J. van der Laan
361d1e18d1 Merge #20606: Remove unused bits from service flags enum
fa40168ab3102b9ad850f967a0e7fa22dbfbd0c6 Remove unused bits from service flags enum (MarcoFalke)

Pull request description:

  Remove service bits that haven't been observed on the active network for years and won't ever be observed on the network with this meaning. Keeping this dead assignment in our source code forever doesn't add any value.

  I somehow forgot to do this in commit fa0d0ff6e1bee60fde63724ae28a51aac5a94d4a.

ACKs for top commit:
  laanwj:
    Code review ACK fa40168ab3102b9ad850f967a0e7fa22dbfbd0c6
  practicalswift:
    cr ACK fa40168ab3102b9ad850f967a0e7fa22dbfbd0c6
  fanquake:
    ACK fa40168ab3102b9ad850f967a0e7fa22dbfbd0c6

Tree-SHA512: 376e5ac05940493cf2209fea60515c843e978c4b476f2524f6bf7a37a646d237c3ddcf6c0fa23641f9ba550f625609703d9b51b4be631a7f2a90e1092b557232
2023-08-01 12:21:16 -05:00
Wladimir J. van der Laan
b25fa7dcb9 Merge #20568: doc: Use FeeModes doc helper in estimatesmartfee
fa8abdc9953e381715493b259908e246914793b0 rpc: Use FeeModes doc helper in estimatesmartfee (MarcoFalke)

Pull request description:

  Not sure why this doesn't use the doc helper, probably an oversight?

ACKs for top commit:
  laanwj:
    Code review ACK fa8abdc9953e381715493b259908e246914793b0

Tree-SHA512: 1f2dc8356e3476ddcf9cafafa7f9865ad95bed1e3067c0edab8e3c483e374bdbdbecc066167554b4a1b479e28f6a52c4ae6a75a70c67ee4e1ff4f3ba36b04001
2023-08-01 12:21:16 -05:00
Wladimir J. van der Laan
5f5550933f Merge #20468: build: warn when generating man pages for binaries built from a dirty branch
6690adba08006739da0060eb4937126bdfa1181a Warn when binaries are built from a dirty branch. (Tyler Chambers)

Pull request description:

  - Adjusted `--version` flag behavior in bitcoind and bitcoin-wallet to have the same behavior.
  - Added `--version` flag to bitcoin-tx to match.
  - Added functionality in gen-manpages.sh to error when attempting to generate man pages for binaries built from a dirty branch.

  mitigates problem with  issue #20412

ACKs for top commit:
  laanwj:
    Tested ACK 6690adba08006739da0060eb4937126bdfa1181a

Tree-SHA512: b5ca509f1a57f66808c2bebc4b710ca00c6fec7b5ebd7eef58018e28e716f5f2358e36551b8a4df571bf3204baed565a297aeefb93990e7a99add502b97ee1b8
2023-08-01 12:21:16 -05:00
Kittywhiskers Van Gogh
5cb5a6edb0 merge bitcoin#22930: remove glibc back compat 2023-08-01 12:07:31 -05:00
Odysseas Gabrielides
6bacf5423b
feat: v20 evonodes payment adjustment (#5493)
## Issue being fixed or feature implemented
Since v19, Evo nodes are paid 4x blocks in a row.
This needs to be reverted when MN Reward Reallocation activates.

## What was done?
Starting from MN Reward Reallocation activation, Evo nodes are paid one
block in a row (like regular masternodes).
In addition, `nConsecutivePayments` isn't incremented anymore for Evo
nodes.

## How Has This Been Tested?
`feature_llmq_hpmn.py` with MN Reward Reallocation activation.

## Breaking Changes
no

## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [x] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone _(for repository
code-owners and collaborators only)_

---------

Co-authored-by: Konstantin Akimov <knstqq@gmail.com>
2023-07-31 23:52:48 -05:00
Konstantin Akimov
359de5a696
feat: improve unit test "IsTriviallyValid" (#5516)
## Issue being fixed or feature implemented
It partially resolves issue https://github.com/dashpay/dash/issues/5471

Better unit tests are needed to validate changes in ProTx implementation
such as this PR: https://github.com/dashpay/dash/pull/5463

## What was done?
- Invalid ProTx transactions are checked more strictly. The flag "tx is
failed" is not enough now for test to succeed, but error code should
matched with expected error.
- Duplicated implementations of tests for "valid" and "invalid
transaction" are changed to more general code.
- Added extra log output with tx ID for easier debug - to see which
exactly tx is failed in test
 - Supported more by 256 txes in one json file

## How Has This Been Tested?
Run unit tests

## Breaking Changes
N/A

## Checklist:
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have added or updated relevant unit/integration/functional/e2e
tests
- [x] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone
2023-07-31 12:15:03 -05:00
Konstantin Akimov
9bb1b10871
refactor: improved initialization of members of LLMQContext and related changes (#5150)
LLMQContext uses RAII to initialize all members. Ensured that all
members always initialized correctly in proper order if LLMQContext
exists.

BlockAssembler, CChainState use too many agruments and they are making
wrong assumption that members of LLMQContext can be constructed and used
independently, but that's not true. Instead, let's pass LLMQContext
whenever possible.

## Issue being fixed or feature implemented
https://github.com/dashpay/dash-issues/issues/52

## How Has This Been Tested?
Run unit/functional test and introduce no breaking changes.


## Checklist:
- [x] I have performed a self-review of my own code
- [x] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone
2023-07-29 20:23:02 -05:00
Kittywhiskers Van Gogh
d40f28edb4 merge bitcoin#19762: Allow named and positional arguments to be used together 2023-07-28 00:18:27 -05:00
Kittywhiskers Van Gogh
4e82a960b6 merge bitcoin#22309: Add missing atomic include 2023-07-28 00:18:27 -05:00
Kittywhiskers Van Gogh
b1643e7c86 merge bitcoin#21575: Create blockstorage module 2023-07-28 00:18:27 -05:00
Kittywhiskers Van Gogh
94b706e402 merge bitcoin#20605: Signal-safe instant shutdown 2023-07-28 00:18:27 -05:00
Kittywhiskers Van Gogh
6c09b33479 merge bitcoin#15946: Allow maintaining the blockfilterindex when using prune 2023-07-28 00:18:27 -05:00
Kittywhiskers Van Gogh
b8fc743f1f trivial: consistently use context as the argument name for CoreContext 2023-07-28 00:18:27 -05:00
Kittywhiskers Van Gogh
9307a22117 merge bitcoin#19550: Add getindexinfo RPC 2023-07-28 00:18:27 -05:00
Kittywhiskers Van Gogh
77963ba29d rpc: Prune g_chainman usage within Dash-specific RPC modules 2023-07-28 00:18:27 -05:00
Kittywhiskers Van Gogh
60e93cabeb merge bitcoin#21391: Prune g_chainman usage in RPC modules 2023-07-28 00:18:27 -05:00
Kittywhiskers Van Gogh
bbb6815982 fix: resolve cppcheck shadow variable warning
```
src/governance/governance.cpp:558:18: note: Shadow variable
src/governance/governance.cpp:558:18: warning: Local variable '_' shadows outer function [shadowFunction]
```
2023-07-28 00:18:27 -05:00
UdjinM6
b710fe0836
feat: Enable fallbackfee by default on all networks (#5507)
## Issue being fixed or feature implemented
We have plenty of block space. Having `fallbackfee` disabled by default
is needlessly annoying.

## What was done?
Bump `DEFAULT_FALLBACK_FEE` to `1000`, same as it is on `master`
https://github.com/dashpay/dash/blob/master/src/wallet/wallet.h#L68

## How Has This Been Tested?
run tests, send txes on testnet

## Breaking Changes
should be none

## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone _(for repository
code-owners and collaborators only)_
2023-07-27 18:47:30 +03:00
thephez
54a8c393cc
chore: correct rpc typo in mempoolentry help (#5512)
## Issue being fixed or feature implemented
RPC help for mempoolentry incorrectly called the "instantsend" field
"time". The "instantsend" and "unbroadcast" fields were also in a
different order than the actual response.

## What was done?
Changed "time" -> "instantsend" and flipped order of
"instantsend"/"unbroadcast"

## How Has This Been Tested?
Built and checked locally

## Breaking Changes
N/A


## Checklist:
_Go over all the following points, and put an `x` in all the boxes that
apply._
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone _(for repository
code-owners and collaborators only)_
2023-07-27 09:46:19 -05:00
Samuel Dobson
a850f5ff6f
(Partial) Merge #20125: rpc, wallet: Expose database format in getwalletinfo
624bab00dd2cc8e2ebd77dc0a669bc8d507c3721 test: add coverage for getwalletinfo format field (Jon Atack)
5e737a009234cbd7cf53748d3d28a2da5221192f rpc, wallet: Expose database format in getwalletinfo (João Barbosa)

Pull request description:

  Support for sqlite based wallets was added in #19077. This PR adds the `format` key in `getwalletinfo` response, that can be `bdb` or  `sqlite`.

ACKs for top commit:
  jonatack:
    Tested ACK 624bab00dd2cc8e2ebd77dc0a669bc8d507c3721
  laanwj:
    Code review ACK 624bab00dd2cc8e2ebd77dc0a669bc8d507c3721.
  MarcoFalke:
    doesn't hurt ACK 624bab00dd2cc8e2ebd77dc0a669bc8d507c3721
  hebasto:
    ACK 624bab00dd2cc8e2ebd77dc0a669bc8d507c3721, tested on Linux Mint 20 (x86_64).
  meshcollider:
    utACK 624bab00dd2cc8e2ebd77dc0a669bc8d507c3721

Tree-SHA512: a81f8530f040f6381d33e073a65f281993eccfa717424ab6e651c1203cbaf27794dcb7175570459e7fdaa211565bc060d0a3ecbe70d2b6f9c49b8d5071e4441c
2023-07-26 15:40:19 +05:30
fanquake
1ec0e30afb
Merge #19980: refactor: Some wallet cleanups
9b74461fa293453a9eb0b1717b30b3f7fa778d91 refactor: Assert before dereference in CWallet::GetDatabase (João Barbosa)
021feb3187b207d511561c1f0ffd7f9e5e0c9c1d refactor: Drop redudant CWallet::GetDBHandle (João Barbosa)

Pull request description:

ACKs for top commit:
  achow101:
    Code Review ACK 9b74461fa293453a9eb0b1717b30b3f7fa778d91
  meshcollider:
    utACK 9b74461fa293453a9eb0b1717b30b3f7fa778d91
  ryanofsky:
    Code review ACK 9b74461fa293453a9eb0b1717b30b3f7fa778d91. Changes since last review: rebasing due to conflict, dropping wallet path commit c6a5cd7a64c78b162f545a3467d0fea7dcaadfcc as suggested in discussion, making GetDatabase() const in the earlier commit. Giving more descriptive title like

Tree-SHA512: 68cf3b5e9fe0acb3a5cd081086629989f213f1904cc344e5775767b56759a7d905b1e1c303afbe40f172ff81bf07f3719b59d8f6ec2de3fdd53cd0e2d220fb25
2023-07-26 09:37:53 +05:30
MarcoFalke
d5aecb5167
Merge #20425: fuzz: Make CAddrMan fuzzing harness deterministic
17a5f172fa9ec509b1c3f950ee8dfb6f025534d2 fuzz: Make addrman fuzzing harness deterministic (practicalswift)

Pull request description:

  Make `CAddrMan` fuzzing harness deterministic.

  See [`doc/fuzzing.md`](https://github.com/bitcoin/bitcoin/blob/master/doc/fuzzing.md) for information on how to fuzz Bitcoin Core. Don't forget to contribute any coverage increasing inputs you find to the [Bitcoin Core fuzzing corpus repo](https://github.com/bitcoin-core/qa-assets).

  Happy fuzzing :)

ACKs for top commit:
  Crypt-iQ:
    utACK 17a5f172fa9ec509b1c3f950ee8dfb6f025534d2

Tree-SHA512: 725f983745233e9b616782247fa18847e483c074ca4336a5beea8a9009128c3a74b4d50a12662d8ca2177c2e1fc5fc121834df6b459ac0af43c931d77ef7c4d8
2023-07-26 09:37:53 +05:30
MarcoFalke
a9fb349c25
Merge #20497: [Refactor] Add MAX_STANDARD_SCRIPTSIG_SIZE to policy
e416cfc92bf51f6fd088ab61c2306c5e73877dd0 Add MAX_STANDARD_SCRIPTSIG_SIZE to policy (sanket1729)

Pull request description:

  Bitcoin core has a standardness rule for max satisfaction script sig size.
  This PR adds to the policy header file so that it is documented along with
  along policy rules. The initial reasoning that 1650 is an implicit
  limit(would not reach assuming all other policy rules are being
  followed) is outdated.

  As we now know, bitcoin transactions can have spend conditions are more than
  just signatures and there may exist p2sh transactions involving 100 byte
  preimages that maybe non-standard because of this rule. Because this
  rule is no longer implicit, we should explicitly document it in policy
  header file

ACKs for top commit:
  sipa:
    utACK e416cfc92bf51f6fd088ab61c2306c5e73877dd0
  practicalswift:
    cr ACK e416cfc92bf51f6fd088ab61c2306c5e73877dd0
  theStack:
    Code Review ACK e416cfc92bf51f6fd088ab61c2306c5e73877dd0

Tree-SHA512: 1a91ee23dfb6085807e04dd0687d7a443e0f3e0f52d0a995a6599dff28533b0b599afba2724735d93948a64a3e25d0bc016ce3e771c0bd453eef78b22dc2369d
2023-07-26 09:37:53 +05:30
Wladimir J. van der Laan
331991b0d0
Merge #20964: rpc: Add specific error code for "wallet already loaded"
a6739cc86827759c543bf81f5532ec46e40549c3 rpc: Add specific error code for "wallet already loaded" (Wladimir J. van der Laan)

Pull request description:

  Add a separate RPC error code for "wallet already loaded" to avoid having to match on message to detect this.
  Requested by shesek for rust-bitcoinrpc.

  If concept ACKed needs:
  - [ ]  Release note
  - [x]  A functional test (updated the existing test to make it pass, I think this is enough)

ACKs for top commit:
  jonasschnelli:
    Code Review ACK a6739cc86827759c543bf81f5532ec46e40549c3
  promag:
    Code review ACK a6739cc86827759c543bf81f5532ec46e40549c3.

Tree-SHA512: 9091872e6ea148aec733705d6af330f72a02f23b936b892ac28f9023da7430af6332418048adbee6014305b812316391812039e9180f7f3362d11f206c13b7d0
2023-07-26 09:37:52 +05:30
Wladimir J. van der Laan
84fb354c1b
Merge #20575: Do not run functions with necessary side-effects in assert()
5021810650afc3073c2af6953ff046ad4d27a1fc Make CanFlushToDisk a const member function (practicalswift)
281cf995547f7683a9e9186bc6384a9fb6035d10 Do not run functions with necessary side-effects in assert() (practicalswift)

Pull request description:

  Do not run functions with necessary side-effects in `assert()`.

ACKs for top commit:
  laanwj:
    Code review ACK 5021810650afc3073c2af6953ff046ad4d27a1fc
  sipa:
    utACK 5021810650afc3073c2af6953ff046ad4d27a1fc
  theStack:
    Code Review ACK 5021810650afc3073c2af6953ff046ad4d27a1fc 🟢

Tree-SHA512: 38b7faccc2f16a499f9b7b1b962b49eb58580b2a2bbf63ea49dcc418a5ecc8f21a0972fa953f66db9509c7239af67cfa2f9266423fd220963d091034d7332b96
2023-07-26 09:37:51 +05:30
MarcoFalke
f13be5085b
Merge #21713: Refactor ProcessNewBlock to reduce code duplication
9a0653553a0ec403b4e7c6713466e0c7fa10ec94 Refactor ProcessNewBlock to reduce code duplication (R E Broadley)

Pull request description:

  There are probably a few issues with this code (maybe there's even a reason this code is duplicated as it currently is), so apologies in advance that I'm still a little (maybe very) bad with C++

ACKs for top commit:
  MarcoFalke:
    ACK 9a0653553a0ec403b4e7c6713466e0c7fa10ec94 💻
  promag:
    Code review ACK 9a0653553a0ec403b4e7c6713466e0c7fa10ec94.
  theStack:
    Code-review ACK 9a0653553a0ec403b4e7c6713466e0c7fa10ec94 🌴

Tree-SHA512: f8634ffad4b2370204d1a0945db4e27248b9e579d9912784da432b8ee3303cae424fa9f7500000dcfb31e6d29d04a8f7d322d17a6fe3d4adaddd10c539458a8c
2023-07-26 09:37:51 +05:30
Konstantin Akimov
42dcb3ddca
fix!: making MnEhfTx to comply DIP-0023 (#5505)
## Issue being fixed or feature implemented
Current implementation of MnEhfTx is not matched with DIP-0023, this PR
fixes it. It is a prior work for
https://github.com/dashpay/dash/pull/5469

## What was done?
- requestID is fixed from `clsig{quorumHeight}` to `mnhf{versionBit}` +
fixes for signature validation properly
 - v20 is minimal height to accept MnEHF special transactions
- versionBit is not BLS version - removed unrelated wrong code and
validations
- TxMempool will accept MnEHF transaction even if inputs/outputs are
zeroes and no fee
- implemented python's serialization/deserialization of MnEHF
transactions for future using in functional tests
 

## How Has This Been Tested?
Run functional/unit tests. Beside that there's new functional test in
https://github.com/dashpay/dash/pull/5469 that actually test format of
transaction and signature validation - to be merged later.

## Breaking Changes
Payload of MnEhf tx is changed, related consensus rules are changed.


## Checklist:
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have added or updated relevant unit/integration/functional/e2e
tests
- [x] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone
2023-07-25 21:46:55 +03:00
MarcoFalke
5d91734065 Merge #21010: refactor: remove straggling boost::mutex usage
f827e151a2ce96e14aadb9e7d25045fe0a8afbd2 refactor: remove straggling boost::mutex usage (fanquake)

Pull request description:

  After the merge of #18710, the linter is warning:
  ```bash
  A new Boost dependency in the form of "boost/thread/mutex.hpp" appears to have been introduced:
  src/sync.cpp:#include <boost/thread/mutex.hpp>
  src/test/sync_tests.cpp:#include <boost/thread/mutex.hpp>

  ^---- failure generated from test/lint/lint-includes.sh
  ```

  #18710 removed `boost/thread/mutex.hpp` from lint-includes, however in the interim #19337 was merged, which introduced more `boost::mutex` usage.

  Given we no longer use `boost::mutex`, just remove the double lock test and remaining includes.

ACKs for top commit:
  laanwj:
    Code review ACK f827e151a2ce96e14aadb9e7d25045fe0a8afbd2
  hebasto:
    ACK f827e151a2ce96e14aadb9e7d25045fe0a8afbd2

Tree-SHA512: f738b12189fe5b39db3e8f8231e9002714413a962eaf98adc84a6614fa474df5616358cfb1c89b92a2b0564efa9b704a774c49d4a25dca18a0ccc3cd9eabfc0a
2023-07-25 10:45:09 -05:00
MarcoFalke
8b4982bc0b Merge #20448: RPC/Wallet: unloadwallet: Allow specifying wallet_name param matching RPC endpoint wallet
89bdad5b25ae4ac03a486f729a5b58ae6f21946d RPC/Wallet: unloadwallet: Allow specifying wallet_name param matching RPC endpoint (Luke Dashjr)

Pull request description:

  Allow specifying the `wallet_name` param to `unloadwallet` on RPC wallet endpoints, so long as it matches the endpoint wallet.

ACKs for top commit:
  jonatack:
    ACK 89bdad5b25ae4ac03a486f729a5b58ae6f21946d
  MarcoFalke:
    review ACK 89bdad5b25ae4ac03a486f729a5b58ae6f21946d

Tree-SHA512: efb399c33f7b5596870a26a8680f453ca47aa7a6db4e550f9435d13044f1c4bad0ae11e8f0205213409d08b75c4188c3be782e54aafab1f65b97eb8cf5c252a9
2023-07-25 10:45:09 -05:00
Wladimir J. van der Laan
8fee13ef70 Merge #19337: sync: detect double lock from the same thread
95975dd08d8fdaaeaf28e0d06b861ce2748c17b6 sync: detect double lock from the same thread (Vasil Dimov)
4df6567e4cbb4677e8048de2f8008612e1b860b9 sync: make EnterCritical() & push_lock() type safe (Vasil Dimov)

Pull request description:

  Double lock of the same (non-recursive) mutex from the same thread would produce an undefined behavior. Detect this from `DEBUG_LOCKORDER` and react similarly to the deadlock detection.

  This came up during discussion in another, related PR: https://github.com/bitcoin/bitcoin/pull/19238#discussion_r442394521.

ACKs for top commit:
  laanwj:
    code review ACK 95975dd08d8fdaaeaf28e0d06b861ce2748c17b6
  hebasto:
    re-ACK 95975dd08d8fdaaeaf28e0d06b861ce2748c17b6

Tree-SHA512: 375c62db7819e348bfaecc3bd82a7907fcd8f5af24f7d637ac82f3f16789da9fc127dbd0e37158a08e0dcbba01a55c6635caf1d8e9e827cf5a3747f7690a498e
2023-07-25 10:45:09 -05:00
Wladimir J. van der Laan
c1b5ec6360 Merge #20432: net: Treat raw message bytes as uint8_t
fabecce71909c984504c21fa05f91d5f1b471e8c net: Treat raw message bytes as uint8_t (MarcoFalke)

Pull request description:

  Using `uint8_t` from the beginning when messages are `recv`ed has two style benefits:
  * The signedness is clear from reading the code, as it does not depend on the architecture
  * When passing the bytes on, the need for static signedness casts is dropped, making the code a bit less verbose and more coherent

ACKs for top commit:
  laanwj:
    Code review ACK fabecce71909c984504c21fa05f91d5f1b471e8c
  theStack:
    Code Review ACK fabecce71909c984504c21fa05f91d5f1b471e8c
  jonatack:
    Tested ACK fabecce71909c984504c21fa05f91d5f1b471e8c

Tree-SHA512: e6d9803c78633fde3304faf592afa961ff9462a7912d1da97a24720265274aa10ab4168d71b6ec2756b7448dd42585321afee0e5c889e705be778ce9a330d145
2023-07-25 10:45:09 -05:00
Wladimir J. van der Laan
21a6b171dc Merge #20056: net: Use Span in ReceiveMsgBytes
fa5ed3b4ca609426b2622cad235e107d33db7b30 net: Use Span in ReceiveMsgBytes (MarcoFalke)

Pull request description:

  Pass a data pointer and a size as span in `ReceiveMsgBytes` to get the benefits of a span

ACKs for top commit:
  jonatack:
    ACK fa5ed3b4ca609426b2622cad235e107d33db7b30 code review, rebased to current master 12a1c3ad1a43634, debug build, unit tests, ran bitcoind/-netinfo/getpeerinfo
  theStack:
    ACK fa5ed3b4ca609426b2622cad235e107d33db7b30

Tree-SHA512: 89bf111323148d6e6e50185ad20ab39f73ab3a58a27e46319e3a08bcf5dcf9d6aa84faff0fd6afb90cb892ac2f557a237c144560986063bc736a69ace353ab9d
2023-07-25 10:45:09 -05:00
MarcoFalke
994ce01023 Merge bitcoin/bitcoin#21948: test: Fix off-by-one in mockscheduler test RPC
fa2e614d16af84327adf1c02746d0f73e0f48111 test: Fix off-by-one in mockscheduler test RPC (MarcoFalke)

Pull request description:

  Fixes:

  ```
  fuzz: scheduler.cpp:83: void CScheduler::MockForward(std::chrono::seconds): Assertion `delta_seconds.count() > 0 && delta_seconds < std::chrono::hours{1}' failed.
  ==1059066== ERROR: libFuzzer: deadly signal
      #0 0x558f75449c10 in __sanitizer_print_stack_trace (/root/fuzz_dir/scratch/fuzz_gen/code/src/test/fuzz/fuzz+0x5fec10)
      #1 0x558f753f32b8 in fuzzer::PrintStackTrace() fuzzer.o
      #2 0x558f753d68d3 in fuzzer::Fuzzer::CrashCallback() fuzzer.o
      #3 0x7f4a3cbbb3bf  (/lib/x86_64-linux-gnu/libpthread.so.0+0x153bf)
      #4 0x7f4a3c7ff18a in raise (/lib/x86_64-linux-gnu/libc.so.6+0x4618a)
      #5 0x7f4a3c7de858 in abort (/lib/x86_64-linux-gnu/libc.so.6+0x25858)
      #6 0x7f4a3c7de728  (/lib/x86_64-linux-gnu/libc.so.6+0x25728)
      #7 0x7f4a3c7eff35 in __assert_fail (/lib/x86_64-linux-gnu/libc.so.6+0x36f35)
      #8 0x558f7588a913 in CScheduler::MockForward(std::chrono::duration<long, std::ratio<1l, 1l> >) scheduler.cpp:83:5
      #9 0x558f75b0e5b1 in mockscheduler()::$_7::operator()(RPCHelpMan const&, JSONRPCRequest const&) const rpc/misc.cpp:435:30
      #10 0x558f75b0e5b1 in std::_Function_handler<UniValue (RPCHelpMan const&, JSONRPCRequest const&), mockscheduler()::$_7>::_M_invoke(std::_Any_data const&, RPCHelpMan const&, JSONRPCRequest const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:285:9
      #11 0x558f7587a141 in std::function<UniValue (RPCHelpMan const&, JSONRPCRequest const&)>::operator()(RPCHelpMan const&, JSONRPCRequest const&) const /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:688:14
      #12 0x558f7587a141 in RPCHelpMan::HandleRequest(JSONRPCRequest const&) const rpc/util.cpp:565:26
      #13 0x558f756c0086 in CRPCCommand::CRPCCommand(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, RPCHelpMan (*)())::'lambda'(JSONRPCRequest const&, UniValue&, bool)::operator()(JSONRPCRequest const&, UniValue&, bool) const ./rpc/server.h:110:91
      #14 0x558f756c0086 in std::_Function_handler<bool (JSONRPCRequest const&, UniValue&, bool), CRPCCommand::CRPCCommand(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, RPCHelpMan (*)())::'lambda'(JSONRPCRequest const&, UniValue&, bool)>::_M_invoke(std::_Any_data const&, JSONRPCRequest const&, UniValue&, bool&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:285:9
      #15 0x558f756b8592 in std::function<bool (JSONRPCRequest const&, UniValue&, bool)>::operator()(JSONRPCRequest const&, UniValue&, bool) const /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:688:14
      #16 0x558f756b8592 in ExecuteCommand(CRPCCommand const&, JSONRPCRequest const&, UniValue&, bool) rpc/server.cpp:480:20
      #17 0x558f756b8592 in ExecuteCommands(std::vector<CRPCCommand const*, std::allocator<CRPCCommand const*> > const&, JSONRPCRequest const&, UniValue&) rpc/server.cpp:444:13
      #18 0x558f756b8017 in CRPCTable::execute(JSONRPCRequest const&) const rpc/server.cpp:464:13
      #19 0x558f7552457a in (anonymous namespace)::RPCFuzzTestingSetup::CallRPC(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) test/fuzz/rpc.cpp:50:25
      #20 0x558f7552457a in rpc_fuzz_target(Span<unsigned char const>) test/fuzz/rpc.cpp:354:28
      #21 0x558f7544cf0f in std::_Function_handler<void (Span<unsigned char const>), void (*)(Span<unsigned char const>)>::_M_invoke(std::_Any_data const&, Span<unsigned char const>&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:300:2
      #22 0x558f75c05197 in std::function<void (Span<unsigned char const>)>::operator()(Span<unsigned char const>) const /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:688:14
      #23 0x558f75c05197 in LLVMFuzzerTestOneInput test/fuzz/fuzz.cpp:74:5
      #24 0x558f753d8073 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) fuzzer.o
      #25 0x558f753c1f72 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) fuzzer.o
      #26 0x558f753c7d6a in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) fuzzer.o
      #27 0x558f753f3a92 in main (/root/fuzz_dir/scratch/fuzz_gen/code/src/test/fuzz/fuzz+0x5a8a92)
      #28 0x7f4a3c7e00b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
      #29 0x558f7539cc9d in _start (/root/fuzz_dir/scratch/fuzz_gen/code/src/test/fuzz/fuzz+0x551c9d)

ACKs for top commit:
  practicalswift:
    cr ACK fa2e614d16af84327adf1c02746d0f73e0f48111

Tree-SHA512: cfa120265261f0ad019b46c426b915c1c007806b37aecb27016ce780a0ddea5e6fc9b09065fd40684b11183dcd3bf543558d7a655e604695021653540266baf7
2023-07-25 10:45:09 -05:00
MarcoFalke
aec81cde46 (partial) Merge #21424: Net processing: Tidy up CNodeState ctor
6927933782acb9b158787e6f35debb916793f6b1 [net processing] Add ChainSyncTimeoutState default initializers (John Newbery)
55966e0cc03f0e380d21a9434b048d4d515b6729 [net processing] Remove CNodeState ctor body (John Newbery)

Pull request description:

  This addresses the two outstanding review comments from #21370.

ACKs for top commit:
  practicalswift:
    cr ACK 6927933782acb9b158787e6f35debb916793f6b1: patch looks correct
  hebasto:
    ACK 6927933782acb9b158787e6f35debb916793f6b1, I have reviewed the code and it looks OK, I agree it can be merged.

Tree-SHA512: b3ef5c8a096e447887df255406b3a760f01c73e2b942374595416b4b4031fc69b89cd93168c45040489d581f340b2a62d3fbabd207d4307f587c00a7a7daacd1
2023-07-25 10:45:09 -05:00
Wladimir J. van der Laan
5e20e69415 Merge #19851: refactor: Extract ParseOpCode from ParseScript
c92387232f750397da7d131f262c150a608408c2 refactor: Extract ParseOpCode from ParseScript (João Barbosa)

Pull request description:

  Seems more natural to have `mapOpNames` "hidden" in `ParseOpCode` than in `ParseScript`.

  A second lookup in `mapOpNames` is also removed.

ACKs for top commit:
  laanwj:
    ACK c92387232f750397da7d131f262c150a608408c2
  theStack:
    re-ACK c92387232f750397da7d131f262c150a608408c2

Tree-SHA512: d59d1964760622cf365479d44e3e676aa0bf46b60e77160140d967e012042df92121d3224c7551dc96eff5ff3294598cc6bade82adb3f60d28810e18e60e1257
2023-07-25 10:45:09 -05:00
fanquake
afb8f35b51 Merge #19836: rpc: Properly deserialize txs with witness before signing
33330778230961cfbf2a24de36b5877e395cc596 rpc: Adjust witness-tx deserialize error message (MarcoFalke)
cccc7525697e7b8d99b545e34f0f504c78ffdb94 rpc: Properly deserialize txs with witness before signing (MarcoFalke)

Pull request description:

  Signing a transaction can only happen when the transaction has inputs. A transaction with inputs can always be deserialized as witness-transaction. If `try_no_witness` decoding is attempted, this will lead to rare intermittent failures.

  Fixes #18803

ACKs for top commit:
  achow101:
    ACK 33330778230961cfbf2a24de36b5877e395cc596
  ajtowns:
    ACK 33330778230961cfbf2a24de36b5877e395cc596

Tree-SHA512: 73f8a5cdfe03fb0e68908d2fa09752c346406f455694a020ec0dd1267ef8f0a583b8e84063ea74aac127106dd193b72623ca6d81469a94b3f5b3c766ebf2c42b
2023-07-25 10:45:09 -05:00
fanquake
1bd4d8de71 Merge #20408: CConnman: move initialization to declaration
9d09132be4ff99f98ca905c342347d5f35f13350 CConnman: initialise at declaration rather than in Start() (Anthony Towns)

Pull request description:

  Ensure nMaxOutboundTotalBytesSentInCycle and nMaxOutboundCycleStartTime are initialized even if CConnman::Start() is not called. Prevents failures in test/fuzz/connman when run under valgrind.

ACKs for top commit:
  practicalswift:
    ACK 9d09132be4ff99f98ca905c342347d5f35f13350: patch looks correct!
  MarcoFalke:
    review ACK 9d09132be4ff99f98ca905c342347d5f35f13350 , checked that we call Start only once and in the same scope where connman is constructed (AppInitMain) 💸
  jnewbery:
    Code review ACK 9d09132be4

Tree-SHA512: 1c6c893e8c616a91947a8cc295b0ba508af3ecfcdcd94cdc5f95d808cc93c6d1a71fd24dcc194dc583854e9889fb522ca8523043367fb0263370fbcab08c6aaa
2023-07-25 10:45:09 -05:00
Odysseas Gabrielides
92e5f9f35d
feat: Check if settings file is empty (#5504)
## Issue being fixed or feature implemented
Fixes issue #5497.

## What was done?
Checks if settings file is empty, and deletes it if that's the case.

It will will be generated with default value `{}` afterwards.

## How Has This Been Tested?
Running Dash Qt on regtest masternode with `--nocleanup` and
`./src/qt/dash-qt --regtest --datadir=`

## Breaking Changes
No

## Checklist:
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone _(for repository
code-owners and collaborators only)_
2023-07-24 20:58:43 +03:00
UdjinM6
48a1632688
fix: implement missing logic for additional indexes, fix bugs and logging (#5477)
## Issue being fixed or feature implemented
The logic for additional indexes is incomplete, handling of P2PK on
block disconnect is broken (luckily no one is using P2PK and reorgs are
rare) and there are a few other small issues that would be nice to have
fixed.

## What was done?
Pls see individual commits

## How Has This Been Tested?
Run `feature_dbcrash.py`, it should succeed (NOTE: it takes ~30 minutes
to complete, that's normal).
Run `feature_addressindex.py`, `feature_timestampindex.py` and
`feature_spentindex.py` (and other tests) should still succeed too.

## Breaking Changes
n/a

## Checklist:
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone _(for repository
code-owners and collaborators only)_
2023-07-24 20:54:24 +03:00
Kittywhiskers Van Gogh
0a58abab27 merge bitcoin#23601: Don't check if the listening socket is valid 2023-07-24 20:45:49 +03:00
Kittywhiskers Van Gogh
9b36ac6d5d merge bitcoin#21630: split FuzzedSock interface and implementation 2023-07-24 20:45:49 +03:00
Kittywhiskers Van Gogh
4972126d95 merge bitcoin#21677: Avoid use of low file descriptor ids (which may be in use) in FuzzedSock 2023-07-24 20:45:49 +03:00
Kittywhiskers Van Gogh
1b82b4f161 merge bitcoin#21617: Fix uninitialized read in i2p test 2023-07-24 20:45:49 +03:00
Kittywhiskers Van Gogh
5088da93db merge bitcoin#22112: Force port 0 in I2P 2023-07-24 20:45:49 +03:00
Kittywhiskers Van Gogh
bff4d9b551 merge bitcoin#21631: always check the return value of Sock::Wait() 2023-07-24 20:45:49 +03:00
Kittywhiskers Van Gogh
08a6f3f764 merge bitcoin#21387: Refactor sock to add I2P fuzz and unit tests 2023-07-24 20:45:49 +03:00
Kittywhiskers Van Gogh
184bbf5b33 merge bitcoin#21407: limit the size of incoming messages 2023-07-24 20:45:49 +03:00
Kittywhiskers Van Gogh
bf31070808 merge bitcoin#20685: Add I2P support using I2P SAM 2023-07-24 20:45:49 +03:00
Kittywhiskers Van Gogh
cf27db8574 partial bitcoin#21843: enable GetAddr, GetAddresses, and getnodeaddresses by network
excludes:
- 6c98c099918bd20e2d3aa123643d6e3594e080e4
- 3f89c0e9902338ad8a507a938dceeeb3191eece6
- ce6bca88e8c685c69686e0b8dc095ffc3e2ac34d
2023-07-24 20:45:49 +03:00
Kittywhiskers Van Gogh
58bea6a498 merge bitcoin#20995: Avoid initializing version to less than MIN_PEER_PROTO_VERSION 2023-07-24 20:45:49 +03:00
Kittywhiskers Van Gogh
31b7169b3c merge bitcoin#20881: net permission flags in net processing 2023-07-24 20:45:49 +03:00
Kittywhiskers Van Gogh
0644b9b6db partial bitcoin#20789: Rework strong and weak net enum fuzzing
excludes:
- faaef9434c19e3643322ee442c240c166af5adbd
2023-07-24 20:45:49 +03:00
Kittywhiskers Van Gogh
49805c11a5 fuzz: correct CAddrMan GetAddr arguments, cap to 4096 2023-07-24 20:45:49 +03:00
Kittywhiskers Van Gogh
7f2fb78ded fuzz: correct FuzzedSock implementation of Sock interface 2023-07-24 20:45:49 +03:00
MarcoFalke
41ac29d77a Merge #18660: test: Verify findCommonAncestor always initializes outputs
9986608ba93de040490ee0d5584ea33e605f1df0 test: Verify findCommonAncestor always initializes outputs (Russell Yanofsky)

Pull request description:

  Also add code comment to clarify surprising code noted by practicalswift
  https://github.com/bitcoin/bitcoin/pull/18657#issuecomment-614278450

ACKs for top commit:
  MarcoFalke:
    ACK 9986608ba93de040490ee0d5584ea33e605f1df0
  jonatack:
    ACK 9986608ba93de04 modulo @practicalswift's https://github.com/bitcoin/bitcoin/pull/18660#issuecomment-614487724

Tree-SHA512: d79c910291d68b770ef4b09564d274c0e19a6acf43ef1a6691dc889e3944ab3462b86056eeb794fd0c6f2464cfad6cc00711a833f84b32079c69ef9b3c8da24c
2023-07-24 11:42:34 -05:00
Konstantin Akimov
8a0e681cea
feat!: add an implementation of DIP 0027 Credit Asset Locks (#5026)
## Issue being fixed or feature implemented
This is an implementation of DIP0027 "Credit Asset Locks".
It's a mechanism to fluidly exchange between Dash and credits.

## What was done?
This pull request includes:
      - Asset Lock transaction
      - Asset Unlock transaction (withdrawal)
      - Credit Pool in coinbase
      - Unit tests for Asset Lock/Unlock tx
      - New functional test `feature_asset_locks.py`

RPC: currently locked amount (credit pool) is available through rpc call
`getblock`.

## How Has This Been Tested?
There added new unit tests for basic checks of transaction validity
(asset lock/unlock).
Also added new functional test "feature_asset_locks.py" that cover
typical cases, but not all corner cases yet.

## Breaking Changes
This feature should be activated as hard-fork because:
- It adds 2 new special transaction and one of them [asset unlock tx]
requires update consensus rulels
 - It adds new data in coinbase tx (credit pool)

## Checklist:
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] I have made corresponding changes to the documentation
**To release DIP 0027**
- [x] I have assigned this pull request to a milestone

---------

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2023-07-24 11:39:38 -05:00
UdjinM6
3c65626609
fix: Process dsq messages even when CJ is disabled locally or disk space is low (#5498)
## Issue being fixed or feature implemented
Refusing to process `dsq` will result in node not being able to process
`dstx`es later.

## What was done?

## How Has This Been Tested?

## Breaking Changes
n/a

## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone _(for repository
code-owners and collaborators only)_
2023-07-24 10:05:27 -05:00
UdjinM6
5382d05b7e
feat: bury v19 activation (#5496)
## Issue being fixed or feature implemented
V19 is active on mainnet/testnet now, no need to check activation bits
anymore. This PR also bumps `MinBIP9WarningHeight` to
post-v19-activation height which should stop `unknown new rules
activated (versionbit 8)` warning from appearing.

## What was done?
Bury v19, bump `MinBIP9WarningHeight`

## How Has This Been Tested?
Run tests, reindex on mainnet/testnet.

## Breaking Changes
n/a

## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone _(for repository
code-owners and collaborators only)_
2023-07-23 15:19:38 -05:00
Wladimir J. van der Laan
7caec1df14 Merge #19871: doc: Clarify scope of eviction protection of outbound block-relay peers
d76925478efd35e6fd835370639f2139b28381e4 [doc] Clarify semantic of peer's m_protect w.r.t to outbound eviction logics (Antoine Riard)
ac71fe936da290adf5a3155fe8db5f78b485f1f1 [doc] Clarify scope of eviction protection of outbound block-relay peers (Antoine Riard)

Pull request description:

  Block-relay-only peers were introduced by #15759. According to its
  author, it was intented to make them only immune to outbound peer
  rotation-based eviction and not from all eviction as modified comment
  leans to think of.

  Clearly indicate that outbound block-relay peers aren't protected
  from eviction by the bad/lagging chain logic.

  Fix #19863

ACKs for top commit:
  naumenkogs:
    ACK d76925478efd35e6fd835370639f2139b28381e4
  jonatack:
    ACK d76925478efd35e6fd835370639f2139b28381e4

Tree-SHA512: 597fbd62838a6e39276024165b11514cad20a2e9d33cf9202d261cbadcb62b2df427c858e0cb57e585840d4c1d4600104aa53916bb868541f2580e4eed9b4b52
2023-07-21 16:03:00 -05:00
Samuel Dobson
4f3a1effbf Merge #20271: doc: Document that wallet salvage is experimental
fab94534b64593be1620c989bf69eb02e1be9b1b doc: Document that wallet salvage is experimental (MarcoFalke)

Pull request description:

  See #20151

ACKs for top commit:
  practicalswift:
    ACK fab94534b64593be1620c989bf69eb02e1be9b1b: user safety first
  hebasto:
    ACK fab94534b64593be1620c989bf69eb02e1be9b1b, maybe capitalize into "WARNING"?
  meshcollider:
    Trivial ACK fab94534b64593be1620c989bf69eb02e1be9b1b

Tree-SHA512: 94912c491facc485293e4333066057933d706d84c7172f615296e7ba998c583c8bd07e751e6f00cd6576e7791007ace321f959181f7bf6a4e15e10d7ec8a1b7e
2023-07-21 16:03:00 -05:00
MarcoFalke
281d2222e1 Merge #18601: wallet: Refactor WalletRescanReserver to use wallet reference
fc289b7898fb90d4800675b69c0bb9b42df5599f wallet: Refactor WalletRescanReserver to use wallet reference (João Barbosa)

Pull request description:

  Simple refactor to `WalletRescanReserver` to use wallet reference instead of pointer.

  Complements #18259.

ACKs for top commit:
  MarcoFalke:
    ACK fc289b7898fb90d4800675b69c0bb9b42df5599f

Tree-SHA512: b03e33f2d9df2870436aa3284137fd022dd89ea96a1b170fa27f8685ad4f986e6c4ba5975a84966c30d18430a4014d7d8740a1dff2f985c9ef8226ed18e69db9
2023-07-21 16:03:00 -05:00
Samuel Dobson
f83b4bfdb3 Merge #17824: wallet: Prefer full destination groups in coin selection
a2324e4d3f47f084b07a364c9a360a0bf31e86a0 test: Improve naming and logging of avoid_reuse tests (Fabian Jahr)
1abbdac6777bc5396d17a6772c8176a354730997 wallet: Prefer full destination groups in coin selection (Fabian Jahr)

Pull request description:

  Fixes #17603 (together with #17843)

  In the case of destination groups of >10 outputs existing in a wallet with `avoid_reuse` enabled, the grouping algorithm is adding left-over outputs as an "incomplete" group to the list of groups even when a full group has already been added. This leads to the strange behavior that if there are >10 outputs for a destination the transaction spending from that will effectively use `len(outputs) % 10` as inputs for that transaction.

  From the original PR and the code comment I understand the correct behavior should be the usage of 10 outputs. I opted for minimal changes in the current code although there maybe optimizations possible for cases with >20 outputs on a destination this sounds like too much of an edge case right now.

ACKs for top commit:
  jonatack:
    Re-ACK a2324e4
  achow101:
    ACK a2324e4d3f47f084b07a364c9a360a0bf31e86a0
  kallewoof:
    ACK a2324e4d3f47f084b07a364c9a360a0bf31e86a0
  meshcollider:
    Tested ACK a2324e4d3f47f084b07a364c9a360a0bf31e86a0 (verified the new test fails on master without this change)

Tree-SHA512: 4743779c5d469fcd16df5baf166024b1d3c8eaca151df1e8281b71df62b29541cf7bfee3f8ab48d83e3b34c9256e53fd38a7b146a54c79f9caa44cce3636971a
2023-07-21 16:03:00 -05:00
Wladimir J. van der Laan
c0c00f9295 Merge #16946: wallet: include a checksum of encrypted private keys
d67055e00dd90f504384e5c3f229fc95306d5aac Upgrade or rewrite encrypted key checksums (Andrew Chow)
c9a9ddb4142af0af5f7b1a5ccd13f8e585007089 Set fDecryptionThoroughlyChecked based on whether crypted key checksums are valid (Andrew Chow)
a8334f7ac39532528c5f8bd3b0eea05aa63e8794 Read and write a checksum for encrypted keys (Andrew Chow)

Pull request description:

  Adds a checksum to the encrypted key record in the wallet database so that encrypted keys can be checked for corruption on wallet loading, in the same way that unencrypted keys are. This allows for us to skip the full decryption of keys upon the first unlocking of the wallet in that session as any key corruption will have already been detected. The checksum is just the double SHA256 of the encrypted key and it is appended to the record after the encrypted key itself.

  This is backwards compatible as old wallets will be able to read the encrypted key and ignore that there is more data in the stream. Additionally, old wallets will be upgraded upon their first unlocking (so that key decryption is checked before we commit to a checksum of the encrypted key) and a wallet flag set indicating that. The presence of the wallet flag lets us skip the full decryption as if `fDecryptionThoroughlyChecked` were true.

  This does mean that the first time an old wallet is unlocked in a new version will take much longer, but subsequent unlocks will be instantaneous. Furthermore, corruption will be detected upon loading rather than on trying to send so wallet corruption will be detected sooner.

  Fixes #12423

ACKs for top commit:
  laanwj:
    code review ACK d67055e00dd90f504384e5c3f229fc95306d5aac
  jonatack:
    Code review ACK d67055e00dd90f504384e5c3f229fc95306d5aac
  meshcollider:
    Code review ACK d67055e00dd90f504384e5c3f229fc95306d5aac

Tree-SHA512: d5c1c10cfcb5db9e10dcf2326423565a9f499290b81f3155ec72254ed5bd7491e2ff5c50e98590eb07842c20d7797b4efa1c3475bae64971d500aad3b4e711d4
2023-07-21 16:03:00 -05:00
Wladimir J. van der Laan
2c5cb249be Merge #11413: [wallet] [rpc] sendtoaddress/sendmany: Add explicit feerate option
25dac9fa65243ca8db02df22f484039c08114401 doc: add release notes for explicit fee estimators and bumpfee change (Karl-Johan Alm)
05227a35545d7656450874b3668bf418c73813fb tests for bumpfee / estimate_modes (Karl-Johan Alm)
3404c1b753432c4859a4ca245f01c240610a00cb policy: optional FeeEstimateMode param to CFeeRate::ToString (Karl-Johan Alm)
6fcf4484302d13bd7739b617470d8c8e31974908 rpc/wallet: add two explicit modes to estimate_mode (Karl-Johan Alm)
b188d80c2de9ebb114da5ceea78baa46bde7dff6 MOVEONLY: Make FeeEstimateMode available to CFeeRate (Karl-Johan Alm)
5d1a411eb12fc700804ffe5d6e205234d30edd5f fees: add FeeModes doc helper function (Karl-Johan Alm)
91f6d2bc8ff4d4cd1b86daa370ec9d2d9662394d rpc/wallet: add conf_target as alias to confTarget in bumpfee (Karl-Johan Alm)
69158b41fc488e4f220559da17a475eff5923a95 added CURRENCY_ATOM to express minimum indivisible unit (Karl-Johan Alm)

Pull request description:

  This lets users pick their own fees when using `sendtoaddress`/`sendmany` if they prefer this over the estimators.

ACKs for top commit:
  Sjors:
    re-utACK 25dac9fa65: rebased, more fancy C++,
  jonatack:
    ACK 25dac9fa65243ca8db02df2 I think this should be merged after all this time, even though it looks to me like there are needed follow-ups, fixes and test coverage to be added (see further down), which I don't mind helping out with, if wanted.
  fjahr:
    Code review ACK 25dac9fa65243ca8db02df22f484039c08114401

Tree-SHA512: f31177e6cabf3187a43cdfe93477144f8e8385c7344613743cbbd16e8490d53ff5144aec7b9de6c9a65eb855b55e0f99d7f164dee4b6bf3cfea4dce51cf11d33
2023-07-21 16:03:00 -05:00
MarcoFalke
c585d57fec Merge #18875: fuzz: Stop nodes in process_message* fuzzers
fab860aed4878b831dae463e1ee68029b66210f5 fuzz: Stop nodes in process_message* fuzzers (MarcoFalke)
6666c828e072a5e99ea0c16394ca3e5b9de07409 fuzz: Give CNode ownership to ConnmanTestMsg in process_message fuzz harness (MarcoFalke)

Pull request description:

  Background is that I saw an integer overflow in net_processing

  ```
  #30629113	REDUCE cov: 25793 ft: 142917 corp: 3421/2417Kb lim: 4096 exec/s: 89 rss: 614Mb L: 1719/4096 MS: 1 EraseBytes-
  net_processing.cpp:977:25: runtime error: signed integer overflow: 2147483624 + 100 cannot be represented in type 'int'
  SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior net_processing.cpp:977:25 in
  net_processing.cpp:985:9: runtime error: signed integer overflow: -2147483572 - 100 cannot be represented in type 'int'
  SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior net_processing.cpp:985:9 in
  ```

  Telling from the line numbers, it looks like `nMisbehavior` wrapped around.

  Fix that by calling `StopNodes` after each exec, which should clear the node state and thus `nMisbehavior`.

ACKs for top commit:
  practicalswift:
    ACK fab860aed4878b831dae463e1ee68029b66210f5

Tree-SHA512: 891c081d5843565d891aec028b6c27ef3fa39bc40ae78238e81d8f784b4d4b49cb870998574725a5159dd03aeeb2e0b9bc3d3bb51d57d1231ef42e3394b2d639
2023-07-21 16:03:00 -05:00
Konstantin Akimov
be1ca25e21
refactor: hide some payments methods, replace a class to namespace (#5494)
## Issue being fixed or feature implemented
Here's TODO that seems out-dated
```
/// TODO: all 4 functions do not belong here really, they should be refactored/moved somewhere (main.cpp ?)
```
This changes are extracted from this PR:
https://github.com/dashpay/dash/pull/5342


## What was done?
This changes hides some methods from global namespace (making local
static function), hiding other functions to the namespace



## How Has This Been Tested?
Run unit/functional tests

## Breaking Changes
N/A


## Checklist:
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone
2023-07-21 10:43:09 -05:00
Konstantin Akimov
e0252bb816
fix: write in logs of TxMempool tx's hashes instead whole txes (#5495)
## What was done?
write in logs of TxMempool tx's hashes instead whole txes


## How Has This Been Tested?
Run unit/functional tests

## Breaking Changes
N/A

## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone
2023-07-17 16:03:40 -05:00