Commit Graph

703 Commits

Author SHA1 Message Date
MarcoFalke
30b57e072f Merge #21187: Net processing: Only call PushAddress() from net_processing
3e68efa615968e0c9d68a7f197c7852478f6be78 [net] Move checks from GetLocalAddrForPeer to caller (John Newbery)
d21d2b264cd77c027a06f68289cf4c3f177d1ed0 [net] Change AdvertiseLocal to GetLocalAddrForPeer (John Newbery)

Pull request description:

  This is the first part of #21186. It slightly disentangles addr handling in net/net_processing by making it explicit that net_processing is responsible for pushing addr records into `vAddrToSend`.

ACKs for top commit:
  MarcoFalke:
    re-ACK 3e68efa615968e0c9d68a7f197c7852478f6be78 🍅

Tree-SHA512: 9af50c41f5a977e2e277f24a589db38e2980b353401def5e74b108ac5f493d9b5d6b1b8bf15323a4d66321495f04bc271450fcef7aa7d1c095f051a4f8e9b15f
2023-08-28 11:24:41 -05:00
Konstantin Akimov
3443630a8c
ci: adds flag -Werror=reorder for arm target (#5540)
## Issue being fixed or feature implemented
The order of members in a class/struct definition and the order of their
initialization should match. This ensures that the code is more
error-proof in cases where the order of member initializations is
important, as they may depend on each other.


Instead manual checking of member initialization better let CI handle
it.
Last PR where it's noticed:
https://github.com/dashpay/dash/pull/5531#discussion_r1299404387

## What was done?
New flag "-Werror=reorder" for `configure.ac` and fixes existing code.

## How Has This Been Tested?
Build code with `--enable-werror`



## 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-08-22 23:19:48 +03:00
PastaPastaPasta
690f47c493
Merge pull request #5490 from vijaydasmp/bp22_2
backport: Merge bitcoin#20023, 21713, 20575, 21989, 20971, 20964, 20497, 20425, 19980, (partial) 20125
2023-08-20 23:39:50 -05:00
fanquake
c32857c05b Merge #20747: net processing: Remove dropmessagestest
176325a5a47befe32d480b3dc206dd0e64e04b21 [net processing] Remove dropmessagestest (John Newbery)

Pull request description:

  -dropmessagestest is a command line option that causes 1 in n received
  messages to be dropped. The Bitcoin P2P protocol is stateful and in
  general cannot handle messages being dropped. Dropped
  version/verack/ping/pong messages will cause the connection to time out
  and be torn down. Other dropped messages may also cause the peer to
  believe that the peer has stalled and tear down the connection.

  It seems difficult to uncover any actual issues with -dropmessagestest,
  and any coverage that could be generated would probably be easier to
  trigger with fuzz testing.

ACKs for top commit:
  MarcoFalke:
    cr ACK 176325a5a47befe32d480b3dc206dd0e64e04b21
  practicalswift:
    cr ACK 176325a5a47befe32d480b3dc206dd0e64e04b21
  dhruv:
    cr ACK 176325a
  amitiuttarwar:
    ACK 176325a5a47befe32d480b3dc206dd0e64e04b21

Tree-SHA512: bd582e5e8c9eb272a5d8ec01ff07c36c0033fbb84c30d1c72c87a7a6c7290021dcaf7bf549179a8b95aeb4f7243158d5593bc7fcf1ec16213782e470fe36bb89
2023-08-08 06:33:29 -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
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
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
Kittywhiskers Van Gogh
b1643e7c86 merge bitcoin#21575: Create blockstorage module 2023-07-28 00:18:27 -05:00
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
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
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
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
UdjinM6
4fb7cdba70
chore: Drop MSG_LEGACY_TXLOCK_REQUEST/LEGACYTXLOCKREQUEST (#5483)
## Issue being fixed or feature implemented
Legacy IS messages are gone long time ago, no need to keep them in code.

## What was done?
Drop `MSG_LEGACY_TXLOCK_REQUEST`/`LEGACYTXLOCKREQUEST`

## How Has This Been Tested?
Run 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 _(for repository
code-owners and collaborators only)_
2023-07-17 01:02:15 +03:00
Kittywhiskers Van Gogh
6c7bd58eed merge bitcoin#21789: Remove ::Params() global from CChainState 2023-06-06 22:38:56 +05:30
Kittywhiskers Van Gogh
9e60bdff16 merge bitcoin#21525: Followup fixups to bundle 4 2023-06-06 22:38:56 +05:30
Kittywhiskers Van Gogh
6ba54ca251 merge bitcoin#21270: Prune g_chainman usage in validation-adjacent modules 2023-06-06 22:38:56 +05:30
Kittywhiskers Van Gogh
01130228f0 merge bitcoin#19697: Improvements on ADDR caching 2023-06-05 10:11:03 -05:00
Kittywhiskers Van Gogh
56cd0dd80a merge bitcoin#19658: Allow RPC to fetch all addrman records and add records to addrman 2023-06-05 10:11:03 -05:00
Kittywhiskers Van Gogh
1244d59522 merge bitcoin#18991: Cache responses to GETADDR to prevent topology leaks 2023-06-05 10:11:03 -05:00
Kittywhiskers Van Gogh
a13b72397b merge bitcoin#19191: Extract download permission from noban 2023-06-05 10:11:03 -05:00
Kittywhiskers Van Gogh
91d800dce3 merge bitcoin#18968: noban precludes maxuploadtarget disconnects 2023-06-05 10:11:03 -05:00
Konstantin Akimov
86dc99f10d
refactor: using reference instead reference to unique_ptr with object (#5381)
## Issue being fixed or feature implemented
Many objects created and functions called by passing `const
std::unique_ptr<Obj>& obj` instead directly passing `Obj& obj`

In some cases it is indeed needed, but in most cases it is just extra
complexity that is better to avoid.

Motivation:
- providing reference to object instead `unique_ptr` is giving warranty
that there's no `nullptr` and no need to keep it in mind
- value inside unique_ptr by reference can be changed externally and
instead `nullptr` it can turn to real object later (or in opposite)
 - code is shorter but cleaner

Based on that this refactoring is useful as it reduces mental load when
reading or writing code.
`std::unique` should be used ONLY for owning object, but not for passing
it everywhere.

## What was done?
Replaced most of usages `std::unique_ptr<Obj>& obj` to `Obj& obj`.
Btw, in several cases implementation assumes that object can be nullptr
and replacement to reference is not possible.
Even using raw pointer is not possible, because the empty
std::unique_ptr can be initialized later somewhere in code.
For example, in `src/init.cpp` there's called `PeerManager::make` and
pass unique_ptr to the `node.llmq_ctx` that would be initialized way
later.
That is out of scope this PR.
List of cases, where reference to `std::unique_ptr` stayed as they are:
- `std::unique_ptr<LLMQContext>& llmq_ctx` in `PeerManagerImpl`,
`PeerManager` and `CDSNotificationInterface`
- `std::unique_ptr<CDeterministicMNManager>& dmnman` in
`CDSNotificationInterface`

Also `CChainState` have 3 references to `unique_ptr` that can't be
replaced too:
 - `std::unique_ptr<llmq::CChainLocksHandler>& m_clhandler;`
 - `std::unique_ptr<llmq::CInstantSendManager>& m_isman;`
- `std::unique_ptr<llmq::CQuorumBlockProcessor>&
m_quorum_block_processor;`


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

## Breaking Changes
No breaking changes, all of these changes - are internal APIs for Dash
Core developers only.

## 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

---------

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2023-06-04 15:26:23 -05:00
MarcoFalke
39d0904494 Merge #17399: validation: Templatize ValidationState instead of subclassing
10efc0487c442bccb0e4a9ac29452af1592a3cf2 Templatize ValidationState instead of subclassing (Jeffrey Czyz)
10e85d4adc9b7dbbda63e00195e0a962f51e4d2c Remove ValidationState's constructor (Jeffrey Czyz)
0aed17ef2892478c28cd660e53223c6dd1dc0187 Refactor FormatStateMessage into ValidationState (Jeffrey Czyz)

Pull request description:

  This removes boilerplate code in the subclasses which otherwise only
  differ by the result type.

  The subclassing was introduced in a27a295.

ACKs for top commit:
  MarcoFalke:
    ACK 10efc0487c442bccb0e4a9ac29452af1592a3cf2 🐱
  ajtowns:
    ACK 10efc0487c442bccb0e4a9ac29452af1592a3cf2 -- looks good to me
  jonatack:
    ACK 10efc048 code review, build/tests green, nice cleanup

Tree-SHA512: 765dd52dde7d49b9a5c6d99d97c96f4492673e2aed0b0604faa88db0308fa4500a26bf755cca0b896be283874096c215932e1110a2d01dc012cd36a5fce58a42
2023-05-24 12:43:57 -05:00
Konstantin Akimov
b8b37f314b Merge #17891: scripted-diff: Replace CCriticalSection with RecursiveMutex
e09c701e0110350f78366fb837308c086b6503c0 scripted-diff: Bump copyright of files changed in 2020 (MarcoFalke)
6cbe6209646db8914b87bf6edbc18c6031a16f1e scripted-diff: Replace CCriticalSection with RecursiveMutex (MarcoFalke)

Pull request description:

  `RecursiveMutex` better clarifies that the mutex is recursive, see also the standard library naming: https://en.cppreference.com/w/cpp/thread/recursive_mutex

  For that reason, and to avoid different people asking me the same question repeatedly (e.g. https://github.com/bitcoin/bitcoin/pull/15932#pullrequestreview-339175124 ), remove the outdated alias `CCriticalSection` with a scripted-diff
2023-05-24 12:43:57 -05:00
Kittywhiskers Van Gogh
3b89dbf742 merge bitcoin#20942: Move some net_processing globals into PeerManagerImpl 2023-05-18 12:11:15 -05:00
Kittywhiskers Van Gogh
d663d47be9 merge bitcoin#20811: move net_processing implementation details out of header 2023-05-11 09:19:47 -05:00
Kittywhiskers Van Gogh
6f3060b763 merge bitcoin#20649: Remove nMyStartingHeight from CNode/Connman 2023-05-11 09:19:47 -05:00
Kittywhiskers Van Gogh
2c3feb8e4b merge bitcoin#20217: Remove g_relay_txes 2023-05-11 09:19:47 -05:00
Kittywhiskers Van Gogh
296e0dd28e merge bitcoin#19910: Move peer_map to PeerManager 2023-05-11 09:19:47 -05:00
Kittywhiskers Van Gogh
d0a35831db net: rename misbehavior members using scripted-diff
implements 8e35bf59062b3a823182588e0bf809b3367c2be0 from https://github.com/bitcoin/bitcoin/pull/19607
2023-05-11 09:19:47 -05:00
Kittywhiskers Van Gogh
60d589014c merge bitcoin#19911: guard vRecvGetData with cs_vRecv and orphan_work_set with g_cs_orphans 2023-05-11 09:19:47 -05:00
Kittywhiskers Van Gogh
f2384ffa90 merge bitcoin#19791: Move Misbehaving() to PeerManager 2023-05-11 09:19:47 -05:00
Kittywhiskers Van Gogh
d9d98505e4 net: pass PeerLogicValidation to remaining ProcessMessages 2023-05-11 09:19:47 -05:00
Wladimir J. van der Laan
2ad00d50e0 Merge #17762: net: Log to net category for exceptions in ProcessMessages
4bdd68f301a9cee3360deafc7531c638e923226b Add missing typeinfo includes (Wladimir J. van der Laan)
4d88c3dcb61e7c075ed3dd442044e0eff4e3c8de net: Log to net category for exceptions in ProcessMessages (Wladimir J. van der Laan)

Pull request description:

  Remove the forest of special exceptions based on string matching, and simply log a short message to the NET logging category when an exception happens during packet processing. It is not good to panick end users with verbose errors (let alone writing to stderr) when any peer can generate them.

ACKs for top commit:
  MarcoFalke:
    re-ACK 4bdd68f301a9cee3360deafc7531c638e923226b (only change is adding includes) 🕕
  promag:
    ACK 4bdd68f301a9cee3360deafc7531c638e923226b, could squash.

Tree-SHA512: a005591a3202b005c75e01dfa54249db3992e2f9eefa8b3d9d435acf66130417716ed926ce4e045179cf43788f1abc7362d999750681a9c80b318373d611c366
2023-04-25 23:14:25 +03:00
Konstantin Akimov
b026f86903
refactor: drop flag m_block_relay_peer and use m_addr_relay object instead (#5339)
## Issue being fixed or feature implemented
This refactoring is a follow-up changes to backport bitcoin#17164 (PR
#5314)

These changes are reduce difference in implementation for our code and
bitcoin's


## What was done?
Removed a flag m_block_relay_peer. Instead I call IsAddrRelayPeer() that
has same information now.
It changes logic introduced in #4888 due to dash-specific code.


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

## Breaking Changes
No breaking changes

## 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
- [x] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone
2023-04-19 09:57:27 -05:00
MarcoFalke
c0465b4353 Merge #17164: p2p: Avoid allocating memory for addrKnown where we don't need it
b6d2183858975abc961207c125c15791e531edcc Minor refactoring to remove implied m_addr_relay_peer. (User)
a552e8477c5bcd22a5457f4f73a2fd6db8acd2c2 added asserts to check m_addr_known when it's used (User)
090b75c14be6b9ba2efe38a17d141c6e6af575cb p2p: Avoid allocating memory for addrKnown where we don't need it (User)

Pull request description:

  We should allocate memory for addrKnown filter only for those peers which are expected to participate in address relay.

  Currently, we do it for all peers (including SPV and block-relay-only),  which results in extra RAM where it's not needed.

  Upd:
  In future, we would still allow SPVs to ask for addrs, so allocation still will be done by default.
  However, they will be able to opt-out via [this proposal](https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2019-October/017428.html) and then we could save some more memory.
  This PR still saves memory for block-relay-only peers immediately after merging.

Top commit has no ACKs.

Tree-SHA512: e84d93b2615556d466f5ca0e543580fde763911a3bfea3127c493ddfaba8f05c8605cb94ff795d165af542b594400995a2c51338185c298581408687e7812463
2023-04-17 19:34:02 +03:00
Wladimir J. van der Laan
eec81f7b33 Merge #15921: validation: Tidy up ValidationState interface
3004d5a12d09d94bfc4dee2a8e8f2291996a4aaf [validation] Remove fMissingInputs from AcceptToMemoryPool() (John Newbery)
c428622a5bb1e37b2e6ab2c52791ac05d9271238 [validation] Remove unused first_invalid parameter from ProcessNewBlockHeaders() (John Newbery)
7204c6434b944f6ad51b3c895837729d3aa56eea [validation] Remove useless ret parameter from Invalid() (John Newbery)
1a37de4b3174d19a6d8691ae07e92b32fdfaef11 [validation] Remove error() calls from Invalid() calls (John Newbery)
067981e49246822421a7bcc720491427e1dba8a3 [validation] Tidy Up ValidationResult class (John Newbery)
a27a2957ed9afbe5a96caa5f0f4cbec730d27460 [validation] Add CValidationState subclasses (John Newbery)

Pull request description:

  Carries out some remaining tidy-ups remaining after PR 15141:

  - split ValidationState into TxValidationState and BlockValidationState (commit from ajtowns)
  - various minor code style tidy-ups to the ValidationState class
  - remove the useless `ret` parameter from `ValidationState::Invalid()`
  - remove the now unused `first_invalid` parameter from `ProcessNewBlockHeaders()`
  - remove the `fMissingInputs` parameter from `AcceptToMemoryPool()`, and deal with missing inputs the same way as other errors by using the `TxValidationState` object.

  Tip for reviewers (thanks ryanofsky!): The first commit ("[validation] Add CValidationState subclasses" ) is huge and can be easier to start reviewing if you revert the rote, mechanical changes:

  Substitute the commit hash of commit "[validation] Add CValidationState subclasses" for <CommitHash> in the commands below.

  ```sh
  git checkout <CommitHash>
  git grep -l ValidationState | xargs sed -i 's/BlockValidationState\|TxValidationState/CValidationState/g'
  git grep -l ValidationResult | xargs sed -i 's/BlockValidationResult\|TxValidationResult/ValidationInvalidReason/g'
  git grep -l MaybePunish | xargs sed -i 's/MaybePunishNode\(ForBlock\|ForTx\)/MaybePunishNode/g'
  git diff HEAD^
  ```

  After that it's possible to easily see the mechanical changes with:

  ```sh
  git log -p -n1 -U0 --word-diff-regex=. <CommitHash>
  ```

ACKs for top commit:
  laanwj:
    ACK 3004d5a12d09d94bfc4dee2a8e8f2291996a4aaf
  amitiuttarwar:
    code review ACK 3004d5a12d09d94bfc4dee2a8e8f2291996a4aaf. Also built & ran tests locally.
  fjahr:
    Code review ACK 3004d5a12d09d94bfc4dee2a8e8f2291996a4aaf . Only nit style change and pure virtual destructor added since my last review.
  ryanofsky:
    Code review ACK 3004d5a12d09d94bfc4dee2a8e8f2291996a4aaf. Just whitespace change and pure virtual destructor added since last review.

Tree-SHA512: 511de1fb380a18bec1944ea82b513b6192df632ee08bb16344a2df3c40811a88f3872f04df24bc93a41643c96c48f376a04551840fd804a961490d6c702c3d36
2023-04-17 10:42:25 -05:00
Wladimir J. van der Laan
091d813e00 Merge #17004: validation: Remove REJECT code from CValidationState
9075d13153ce06cd59a45644831ecc43126e1e82 [docs] Add release notes for removal of REJECT reasons (John Newbery)
04a2f326ec0f06fb4fce1c4f93500752f05dede8 [validation] Fix REJECT message comments (John Newbery)
e9d5a59e34ff2d538d8f5315efd9908bf24d0fdc [validation] Remove REJECT code from CValidationState (John Newbery)
0053e16714323c1694c834fdca74f064a1a33529 [logging] Don't log REJECT code when transaction is rejected (John Newbery)
a1a07cfe99fc8cee30ba5976dc36b47b1f6532ab [validation] Fix peer punishment for bad blocks (John Newbery)

Pull request description:

  We no longer send BIP 61 REJECT messages, so there's no need to set
  a REJECT code in the CValidationState object.

  Note that there is a minor bug fix in p2p behaviour here. Because the
  call to `MaybePunishNode()` in `PeerLogicValidation::BlockChecked()` only
  previously happened if the REJECT code was > 0 and < `REJECT_INTERNAL`,
  then there are cases were `MaybePunishNode()` can get called where it
  wasn't previously:

  - when `AcceptBlockHeader()` fails with `CACHED_INVALID`.
  - when `AcceptBlockHeader()` fails with `BLOCK_MISSING_PREV`.

  Note that `BlockChecked()` cannot fail with an 'internal' reject code. The
  only internal reject code was `REJECT_HIGHFEE`, which was only set in
  ATMP.

  This reverts a minor bug introduced in 5d08c9c579.

ACKs for top commit:
  ariard:
    ACK 9075d13, changes since last reviewed are splitting them in separate commits to ease understanding and fix nits
  fjahr:
    ACK 9075d13153ce06cd59a45644831ecc43126e1e82, confirmed diff to last review was fixing nits in docs/comments.
  ryanofsky:
    Code review ACK 9075d13153ce06cd59a45644831ecc43126e1e82. Only changes since last review are splitting the main commit and updating comments

Tree-SHA512: 58e8a1a4d4e6f156da5d29fb6ad6a62fc9c594bbfc6432b3252e962d0e9e10149bf3035185dc5320c46c09f3e49662bc2973ec759679c0f3412232087cb8a3a7
2023-04-17 10:42:25 -05:00
MarcoFalke
20fb6158a5 Merge #19378: refactor: Use Mutex type for g_cs_recent_confirmed_transactions
13076867981ab36b3549ab4c29583ae8ed12a709 refactor: Use Mutex type for g_cs_recent_confirmed_transactions (Hennadii Stepanov)

Pull request description:

  No need the `RecursiveMutex` type for the `g_cs_recent_confirmed_transactions`.

  Related to #19303.

ACKs for top commit:
  MarcoFalke:
    ACK 13076867981ab36b3549ab4c29583ae8ed12a709
  vasild:
    ACK 13076867

Tree-SHA512: 67f1be10c80ec18d0f80b9f5036e5a20986314da9b9364ef4e193ad1d9f3f4c8e4c2e16253ca79d649ff602d5b8c2aff58d7dd1085841afb760479a4875cffbe
2023-04-15 12:14:35 -05:00
MarcoFalke
cdb3a6490a Merge #19723: Ignore unknown messages before VERACK
675e55e01392971aa56bda56cb09498b466d0902 Ignore unknown messages before VERACK (Suhas Daftuar)

Pull request description:

  This allows for feature negotiation to take place with messages between VERSION and VERACK in the future, without requiring additional software changes to specifically ignore messages for features that are unimplemented by our software.

ACKs for top commit:
  sipa:
    utACK 675e55e01392971aa56bda56cb09498b466d0902
  practicalswift:
    ACK 675e55e01392971aa56bda56cb09498b466d0902: patch looks correct
  MarcoFalke:
    ACK 675e55e01392971aa56bda56cb09498b466d0902
  hebasto:
    ACK 675e55e01392971aa56bda56cb09498b466d0902, the offender peer will be eventually disconnected due to the timeout.

Tree-SHA512: 8d2b1d8b9843f2ee26b2c30f7c5ff0bfcfbe3f46b32cd0369c48ece26624151091237e83ce3f18c6da004099026602cfab1642ac916db777f047d170b365c007
2023-04-09 00:06:56 -05:00
Kittywhiskers Van Gogh
548e8704c5 merge bitcoin#21055: Prune remaining g_chainman usage in validation functions
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2023-04-04 12:41:45 -05:00
Kittywhiskers Van Gogh
30191be0b1 merge bitcoin#20750: Prune g_chainman usage in mempool-related validation functions 2023-04-04 12:41:45 -05:00
Kittywhiskers Van Gogh
9d55bd8d1c merge bitcoin#20749: Prune g_chainman usage related to ::LookupBlockIndex 2023-04-04 12:41:45 -05:00
MarcoFalke
be6a045b8c Merge #18807: [doc / test / mempool] unbroadcast follow-ups
9e1cb1adf1800efe429e348650931f2669b0d2c0 [trivial/doc] Fix comment type (Amiti Uttarwar)
8f30260a67166a6ab7c0f33f7ec1990d3c31761e [doc] Update unbroadcast description in RPC results (Amiti Uttarwar)
750456d6f29c63d57af05bfbdd6035bb9c965de2 [trivial] Remove misleading 'const' (Amiti Uttarwar)
fa32e676e5833a5c5fc735ef00c0a80f5fab7a2c [test] Manage node connections better in mempool persist test (Amiti Uttarwar)
1f94bb0c744a103b633c1051e8fbc01e612097dc [doc] Provide rationale for randomization in scheduling. (Amiti Uttarwar)
9c8a55d9cb0ec73f10b196e79b637aa601c0a6b7 [mempool] Don't throw expected error message when upgrading (Amiti Uttarwar)
ba5498318233ab81decbc585e9619d8ffe2df1b0 [test] Test that wallet transactions aren't rebroadcast before 12 hours (Amiti Uttarwar)
00d44a534b4e5ae249b8011360c6b0f7dc731581 [test] P2P connection behavior should meet expectations (Amiti Uttarwar)
bd093ca15de762fdaf0937a0877d17b0c2bce16e [test] updates to unbroadcast test (Amiti Uttarwar)
dab298d9ab5a5a41685f437db9081fa7b395fa73 [docs] add release notes (Amiti Uttarwar)

Pull request description:

  This PR is a follow up to #18038 which introduced the idea of an unbroadcast set & focuses mostly on documentation updates and test fixes. One small functionality update to not throw an expected error in `LoadMempool` when you upgrade software versions.

  #18895 is another follow up to that addresses other functionality updates.

  Background context:
  The unbroadcast set is a mechanism for the mempool to track locally submitted transactions (via wallet or RPC). The node does a best-effort of delivering the transactions to the network via retries every 10-15 minutes until either a `GETDATA` is received or the transaction is removed from the mempool.

ACKs for top commit:
  MarcoFalke:
    ACK 9e1cb1adf1 👁
  gzhao408:
    ACK [`9e1cb1a`](9e1cb1adf1)

Tree-SHA512: 0cd51c4ca368b9dce92d50d73ec6e9df278a259e609eef2858f24cb8595ad07acc3db781d9eb0c351715f18fca5a2b4526838981fdb34a522427e9dc868bdaa6
2023-02-27 23:12:41 -06:00
fanquake
f1885c2221 Merge #18895: p2p: unbroadcast followups: rpcs, nLastResend, mempool sanity check
651f1d816f054cb9c637f8a99c9360bba381ef58 [test] wait for inital broadcast before comparing mempool entries (gzhao408)
9d3f7eb9860254eb787ebe2734fd6a26bcf365c1 [mempool] sanity check that all unbroadcast txns are in mempool (gzhao408)
a7ebe48b94c5a9195c8eabd193204c499cb4bfdb [rpc] add unbroadcast info to mempool entries and getmempoolinfo (gzhao408)
d16006960443c2efe37c896e46edae9dca86c57d [wallet] remove nLastResend logic (gzhao408)

Pull request description:

  Followup to #18038 by amitiuttarwar which introduces the unbroadcast set: "a mechanism for the mempool to track locally submitted transactions" and decreases the frequency of rebroadcast from 10-15 minutes to 12-36 hours.

  This PR addresses some of the outstanding TODOs building on top of it:
  - remove `nLastResend` logic, which is used to ensure rebroadcast doesn't happen again if no new block has been mined (makes sense in 10-15 min period, but not necessary for 12-36 hour period). (#18038 [comment](https://github.com/bitcoin/bitcoin/pull/18038#discussion_r416826914))
  - expose unbroadcast info via RPCs, for more informative queries and testing (#18038 [comment](https://github.com/bitcoin/bitcoin/pull/18038#discussion_r416837980))
  - add sanity check to verify unbroadcast transactions still exist in mempool before rebroadcasting (#18038 [comment](https://github.com/bitcoin/bitcoin/pull/18038#discussion_r416861609))

ACKs for top commit:
  naumenkogs:
    Code review ACK 651f1d816f054cb9c637f8a99c9360bba381ef58
  amitiuttarwar:
    ACK 651f1d816f054cb9c637f8a99c9360bba381ef58 🎉
  MarcoFalke:
    Review ACK 651f1d816f054cb9c637f8a99c9360bba381ef58

Tree-SHA512: d5327e95ef39d44152b48df5c610502ae11c168f43dbbfb2885340c93d1ba9426eb3a5794573f5fc843502109cb3ffb63efa3f2db4f8f112efcde8f76d9a8845
2023-02-27 23:12:41 -06:00
Kittywhiskers Van Gogh
40906b2bbb partial bitcoin#20228: Make addrman a top-level component 2023-02-28 00:11:11 +03:00
Kittywhiskers Van Gogh
3e993abf10 merge bitcoin#20291: Consolidate logic around calling CAddrMan::Connected() 2023-02-28 00:11:11 +03:00
Kittywhiskers Van Gogh
07fe6d4738 merge bitcoin#19607: Add Peer struct for per-peer data in net processing 2023-02-28 00:11:11 +03:00
Kittywhiskers Van Gogh
698a717ecd partial bitcoin#20187: test-before-evict bugfix and improvements for block-relay-only peers
Contains only daf55531260833d597ee599e2d289ea1be0b1d9c
2023-02-28 00:11:11 +03:00
Kittywhiskers Van Gogh
cca796aeb3 merge bitcoin#14033: Drop CADDR_TIME_VERSION checks now that MIN_PEER_PROTO_VERSION is greater 2023-02-28 00:11:11 +03:00
MarcoFalke
c618e5cdf8 Merge #19556: Remove mempool global
fafb381af8279b2d2ca768df0bf68d7eb036a2f9 Remove mempool global (MarcoFalke)
fa0359c5b30730744aa8a7cd9ffab79ded91041f Remove mempool global from p2p (MarcoFalke)
eeee1104d78eb59a582ee1709ff4ac2c33ee1190 Remove mempool global from init (MarcoFalke)

Pull request description:

  This refactor unlocks some nice potential features, such as, but not limited to:
  * Removing the fee estimates global (would avoid slightly fragile workarounds such as #18766)
  * Making the mempool optional for a "blocksonly" operation mode

  Even absent those features, the new code without the global should be easier to maintain, read and write tests for.

ACKs for top commit:
  jnewbery:
    utACK fafb381af8279b2d2ca768df0bf68d7eb036a2f9
  hebasto:
    ACK fafb381af8279b2d2ca768df0bf68d7eb036a2f9, I have reviewed the code and it looks OK, I agree it can be merged.
  darosior:
    ACK fafb381af8279b2d2ca768df0bf68d7eb036a2f9

Tree-SHA512: a2e696dc377e2e81eaf9c389e6d13dde4a48d81f3538df88f4da502d3012dd61078495140ab5a5854f360a06249fe0e1f6a094c4e006d8b5cc2552a946becf26
2023-02-15 00:07:39 -06:00
Wladimir J. van der Laan
97b7ecb256 Merge #17477: Remove the mempool's NotifyEntryAdded and NotifyEntryRemoved signals
e57980b4738c10344baf136de3e050a3cb958ca5 [mempool] Remove NotifyEntryAdded and NotifyEntryRemoved callbacks (John Newbery)
2dd561f36124972d2364f941de9c3417c65f05b6 [validation] Remove pool member from ConnectTrace (John Newbery)
969b65f3f527631ede1a31c7855151e5c5d91f8f [validation] Remove NotifyEntryRemoved callback from ConnectTrace (John Newbery)
5613f9842b4000fed088b8cf7b99674c328d15e1 [validation] Remove conflictedTxs from PerBlockConnectTrace (John Newbery)
cdb893443cc16edf974f099b8485e04b3db1b1d7 [validation interface] Remove vtxConflicted from BlockConnected (John Newbery)
1168394d759b13af68acec6d5bfa04aaa24561f8 [wallet] Notify conflicted transactions in TransactionRemovedFromMempool (John Newbery)

Pull request description:

  These boost signals were added in #9371, before we had a `TransactionRemovedFromMempool` method in the validation interface. The `NotifyEntryAdded` callback was used by validation to build a vector of conflicted transactions when connecting a block, which the wallet was notified of in the `BlockConnected` CValidationInterface callback.

  Now that we have a `TransactionRemovedFromMempool` callback, we can fire that signal directly from the mempool for conflicted transactions.

  Note that #9371 was implemented to ensure `-walletnotify` events were fired for these conflicted transaction. We inadvertently stopped sending these notifications in #16624 (Sep 2019 commit 7e89994). We should probably fix that, but in a different PR.

ACKs for top commit:
  jonatack:
    Re-ACK e57980b
  ryanofsky:
    Code review ACK e57980b4738c10344baf136de3e050a3cb958ca5, no code changes since previous review, but helpful new code comments have been added and the PR description is now more clear about where the old code came from

Tree-SHA512: 3bdbaf1ef2731e788462d4756e69c42a1efdcf168691ce1bbfdaa4b7b55ac3c5b1fd4ab7b90bcdec653703600501b4224d252cfc086aef28f9ce0da3b0563a69
2023-02-15 00:07:39 -06:00
Kittywhiskers Van Gogh
383f902abf merge bitcoin#19583: clean up Misbehaving() 2023-02-03 15:25:38 -06:00
Kittywhiskers Van Gogh
24546f93e5 merge bitcoin#19472: Reduce cs_main scope in MaybeDiscourageAndDisconnect() 2023-02-03 15:25:38 -06:00
Kittywhiskers Van Gogh
99f6c314c0 refactor: rearrange argument order to be more consistent 2023-02-03 15:25:38 -06:00
Kittywhiskers Van Gogh
a4e0327c29 refactor: pass CNode by reference for ProcessMessage functions 2023-02-03 15:25:38 -06:00
Kittywhiskers Van Gogh
97d485159b refactor: rename ProcessSporkMessages to match other functions 2023-02-03 15:25:38 -06:00
Kittywhiskers Van Gogh
260ef0a811 merge bitcoin#19704: move ProcessMessage() to PeerLogicValidation 2023-02-03 15:25:38 -06:00
Kittywhiskers Van Gogh
af0dd17ca6 merge bitcoin#19293: Avoid redundant and confusing FAILED log 2023-02-03 15:25:38 -06:00
Kittywhiskers Van Gogh
0b1a30afc1 merge bitcoin#19174: replace CConnman pointers by references in net_processing.cpp 2023-02-03 15:25:38 -06:00
Kittywhiskers Van Gogh
0385df1bc7 merge bitcoin#19053: replace CNode pointers by references within net_processing.{h,cpp} 2023-02-03 15:25:38 -06:00
fanquake
de50c799d4 Merge #18808: [net processing] Drop unknown types in getdata
9847e205bf7edcac4c30ce4b6d62f482aa7bc1b7 [docs] Improve commenting in ProcessGetData() (John Newbery)
2f032556e08a04807c71eb02104ca9589eaadf1b [test] test that an invalid GETDATA doesn't prevent processing of future messages (Amiti Uttarwar)
e257cf71c851e25e1a533bf1d4296f6b55c81332 [net processing] ignore unknown INV types in GETDATA messages (Amiti Uttarwar)
047ceac142246b5d51056a51dbf4645b31802be4 [net processing] ignore tx GETDATA from blocks-only peers (Amiti Uttarwar)

Pull request description:

  Currently we'll stall peers that send us an unknown INV type in a GETDATA message. Be a bit more friendly and just drop the invalid request.

  Ditto for blocks-relay-only peers that send us a GETDATA for a transaction.

  There's a test for the first part. The second is difficult to test in the functional test framework since we aren't able to make blocks-relay-only connections.

ACKs for top commit:
  sipa:
    utACK 9847e205bf7edcac4c30ce4b6d62f482aa7bc1b7
  brakmic:
    ACK 9847e205bf
  luke-jr:
    utACK 9847e205bf7edcac4c30ce4b6d62f482aa7bc1b7
  naumenkogs:
    utACK 9847e20
  ajtowns:
    utACK 9847e205bf7edcac4c30ce4b6d62f482aa7bc1b7

Tree-SHA512: 6007f2fd839ffe737727f6fb8e8f083b2d9e05a510748f1d40b8f9be8fdf7b5419a36d8f1039923eec1ba2983e8f6f0436ec5fc196d9f6dcb0657f2ff8ff8e4c
2023-01-22 00:27:52 -06:00
fanquake
96e488aa03 Merge #18806: net: remove is{Empty,Full} flags from CBloomFilter, clarify CVE fix
1ad8ea2b73134bdd8d6b50704a019d47ad2191d8 net: remove is{Empty,Full} flags from CBloomFilter, clarify CVE fix (Sebastian Falbesoner)

Pull request description:

  The BIP37 bloom filter class `CBloomFilter` contains two flags `isEmpty`/`isFull` together with an update method with the purpose to, according to the comments, "avoid wasting cpu", i.e. the mechanism should serve as an optimization for the trivial cases of empty (all bits zero) or full (all bits one) filters.
  However, the real reason of adding those flags (introduced with commit 37c6389c5a by gmaxwell) was a _covert fix_ of [CVE-2013-5700](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-5700), a vulnerability that allowed a divide-by-zero remote node crash.
  According to gmaxwell himself (https://github.com/bitcoin/bitcoin/pull/9060#issuecomment-257749165):
  > the IsEmpty/IsFull optimizations were largely a pretextual optimization intended to make unexploitable a remote crash vulnerability (integer division by zero) that existed in the original bloom filtering code without disclosing it. I'm doubtful that they are all that useful. :)

  For more information on how to trigger this crash, see PR https://github.com/bitcoin/bitcoin/pull/18515 which contains a detailled description and a regression test. It has also been discussed on a [recent PR club meeting on fuzzing](https://bitcoincore.reviews/18521.html).

  The covert fix code already led to issues and PR based on the wrong assumption that the flags are there for optimization reasons (see #16886 and #16922). This PR gets rid of the flags and the update method and just focuses on the CVE fix itself, i.e. it can be seen as a revert of the covert fix commit modulo the actual fix.

ACKs for top commit:
  meshcollider:
    utACK 1ad8ea2b73134bdd8d6b50704a019d47ad2191d8
  laanwj:
    Concept and code review ACK 1ad8ea2b73134bdd8d6b50704a019d47ad2191d8
  jkczyz:
    ACK 1ad8ea2b73134bdd8d6b50704a019d47ad2191d8
  MarcoFalke:
    ACK 1ad8ea2b73134bdd8d6b50704a019d47ad2191d8
  fjahr:
    Code review ACK 1ad8ea2b73134bdd8d6b50704a019d47ad2191d8

Tree-SHA512: 29f7ff9faece0285e11e16c024851f5bcb772dec64118ccc3f9067ec256267ec8e1b1e3105c7de2a72fd122c3b085e8fc840ab8f4e49813f1cc7a444df1867f7
2023-01-22 00:27:52 -06:00
MarcoFalke
a8820d894f Merge #19474: doc: Use precise permission flags where possible
fab558612278909df93bdf88f5727b04f13aef0f doc: Use precise permission flags where possible (MarcoFalke)

Pull request description:

  Instead of mentioning the all-encompassing `-whitelist*` settings, change the docs to mention the exact permission flag that will influence the behaviour.

  This is needed because in the future, the too-broad `-whitelist*` settings (they either include *all* permission flags or apply to *all* peers) might be deprecated to require the permission flags to be enumerated.

  Alternatively, in the future there could be an RPC to set the net permission flags on an existing connection, in which case the `-whitelist*` terminology is of no help.

ACKs for top commit:
  jnewbery:
    reACK fab558612278909df93bdf88f5727b04f13aef0f
  fjahr:
    Code review ACK fab558612278909df93bdf88f5727b04f13aef0f
  jonatack:
    ACK fab558612278909df93bdf88f5727b04f13aef0f

Tree-SHA512: c7dea3e577d90103bb2b0ffab7b7c8640b388932a3a880f69e2b70747fc9213dc1f437085671fd54c902ec2a578458b8a2fae6dbe076642fb88efbf9fa9e679c
2023-01-19 23:37:39 -06:00
Kittywhiskers Van Gogh
623a599352 merge bitcoin#18376: fix use-after-free in tests 2023-01-19 03:42:49 +00:00
Kittywhiskers Van Gogh
3d9141b251 merge bitcoin#18289: Make scheduler methods type safe 2023-01-19 03:42:49 +00:00
PastaPastaPasta
4615a071b7
feat(coinjoin): implement new serialization for dsq and dstx (#5136)
## Issue being fixed or feature implemented
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->
https://github.com/dashpay/dash/issues/4966

## What was done?
Serialization now depends on the protocol version, and we use an updated
serialization that is spv friendly for the new version

## How Has This Been Tested?
hasn't

## Breaking Changes
this should be backwards compatible, but this likely should get some
release notes.

## 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

**For repository code-owners and collaborators only**
- [x] I have assigned this pull request to a milestone

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2023-01-11 21:24:29 -06:00
PastaPastaPasta
c9161e2ebf
refactor: begin to de-globalize masternodeSync (#5103)
<!--
*** Please remove the following help text before submitting: ***

Provide a general summary of your changes in the Title above

Pull requests without a rationale and clear improvement may be closed
immediately.

Please provide clear motivation for your patch and explain how it
improves
Dash Core user experience or Dash Core developer experience
significantly:

* Any test improvements or new tests that improve coverage are always
welcome.
* All other changes should have accompanying unit tests (see
`src/test/`) or
functional tests (see `test/`). Contributors should note which tests
cover
modified code. If no tests exist for a region of modified code, new
tests
  should accompany the change.
* Bug fixes are most welcome when they come with steps to reproduce or
an
explanation of the potential issue as well as reasoning for the way the
bug
  was fixed.
* Features are welcome, but might be rejected due to design or scope
issues.
If a feature is based on a lot of dependencies, contributors should
first
  consider building the system outside of Dash Core, if possible.
-->

## Issue being fixed or feature implemented
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->
minimizing global uses

## What was done?
<!--- Describe your changes in detail -->
Started the deglobalization, a future PR should be done to continue this
deglobalization

## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->


## Breaking Changes
<!--- Please describe any breaking changes your code introduces -->
none

## 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
- [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

**For repository code-owners and collaborators only**
- [x] I have assigned this pull request to a milestone

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2023-01-04 23:37:20 +03:00
Odysseas Gabrielides
78d057dd7a
feat!: BLS scheme upgrade (#5021)
Tracking issue is:
[(https://github.com/dashpay/dash/issues/5001)](https://github.com/dashpay/dash/issues/5001)

Co-authored-by: Kittywhiskers Van Gogh <63189531+kittywhiskers@users.noreply.github.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Co-authored-by: pasta <pasta@dashboost.org>
2022-12-29 23:45:31 -06:00
Kittywhiskers Van Gogh
038d8044fd merge bitcoin#15437: Remove BIP61 reject messages 2022-12-02 15:43:01 +05:30
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
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
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
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
Wladimir J. van der Laan
f94a833add Merge #17945: doc: Fix doxygen errors
297e09855793feb94c3229ed989bef8b1eac864e Fix doxygen errors (Ben Woosley)

Pull request description:

  These are all the remaining errors identified via -Werror=documentation, e.g.:
  ```
    ./rpc/rawtransaction_util.h:31:13: error: parameter 'prevTxs' not found in the function declaration [-Werror,-Wdocumentation]
      * @param  prevTxs       Array of previous txns outputs that tx depends on but may not yet be in the block chain
                ^~~~~~~
    ./rpc/rawtransaction_util.h:31:13: note: did you mean 'prevTxsUnival'?
      * @param  prevTxs       Array of previous txns outputs that tx depends on but may not yet be in the block chain
                ^~~~~~~
                prevTxsUnival

    netbase.cpp:766:11: error: parameter 'outProxyConnectionFailed[out]' not found in the function declaration [-Werror,-Wdocumentation]
     * @param outProxyConnectionFailed[out] Whether or not the connection to the
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    netbase.cpp:766:11: note: did you mean 'outProxyConnectionFailed'?
     * @param outProxyConnectionFailed[out] Whether or not the connection to the
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              outProxyConnectionFailed
  ```

  You can use this to run with `-Wdocumentation` yourself: #14920

ACKs for top commit:
  laanwj:
    ACK 297e09855793feb94c3229ed989bef8b1eac864e

Tree-SHA512: a232d893b170873d923e77fa56c56a6567e7fd120b5af1f52cfeeae1093eec55621604cc80a523678f6fedc8bbb31228c4aa8dc2a630ce9ffc91525988522af7
2022-10-17 15:41:14 -05:00
MarcoFalke
f181b0284a Merge #16851: Continue relaying transactions after they expire from mapRelay
168b781fe7f3f13b24c52a151f36de4cdd0a340a Continue relaying transactions after they expire from mapRelay (Anthony Towns)

Pull request description:

  This change allows peers to request transactions even after they've expired from mapRelay and even if they're not doing mempool requests. This is intended to allow for CPFP of old transactions -- if parent tx P wasn't relayed due to low fees, then a higher fee rate child C is relayed, peers will currently request the parent P, but we prior to this patch, we will not relay it due to it not being in mapRelay.

ACKs for top commit:
  MarcoFalke:
    re-ACK 168b781fe7f3f13b24c52a151f36de4cdd0a340a (only change is comment fixup)
  sdaftuar:
    re-ACK 168b781fe7f3f13b24c52a151f36de4cdd0a340a
  sipa:
    ACK 168b781fe7f3f13b24c52a151f36de4cdd0a340a

Tree-SHA512: b206666dd1450cd0a161ae55fd1a7eda2c3d226842ba27d91fe463b551fd924b65b92551b14d6786692e15cf9a9a989666550dfc980b48ab0f8d4ca305bc7762
2022-10-17 15:41:14 -05:00
fanquake
4c0bbb9ab9 Merge #18054: net: reference instead of copy in BlockConnected range loop
9a299a59cc8a9ab516e047356c5bc0e93774b557 net: reference instead of copy in BlockConnected range loop (Jon Atack)

Pull request description:

  Reference elements in range for loop instead of copying them and
  fix Clang `-Wrange-loop-analysis` warning introduced in a029e18

  ```
  net_processing.cpp:1185:25: warning: loop variable 'ptx' of
  type 'const std::shared_ptr<const CTransaction>' creates a copy from
  type 'const std::shared_ptr<const CTransaction>' [-Wrange-loop-analysis]
          for (const auto ptx : pblock->vtx) {
                          ^
  net_processing.cpp:1185:14: note: use reference type
  'const std::shared_ptr<const CTransaction> &' to prevent copying
          for (const auto ptx : pblock->vtx) {
               ^~~~~~~~~~~~~~~~
  1 warning generated.
  ```

ACKs for top commit:
  Empact:
    ACK 9a299a59cc
  MarcoFalke:
    ACK 9a299a59cc8a9ab516e047356c5bc0e93774b557
  promag:
    ACK 9a299a59cc8a9ab516e047356c5bc0e93774b557.
  elichai:
    ACK 9a299a59cc8a9ab516e047356c5bc0e93774b557
  emilengler:
    ACK 9a299a5.

Tree-SHA512: 9284d1b00684877505454a05071212758c8cea083534e2eec09bfc8a9c3059eea811d2008f6a5a678539444f0d5b3134db1bd23da6514b3d3a1440634c8b53be
2022-10-16 13:06:40 -05:00
Jonas Schnelli
2a9a7c9169 Merge #17951: Use rolling bloom filter of recent block txs for AlreadyHave() check
a029e18c2bf67dd00552b0f4bbc85fa2fa5b973b Use rolling bloom filter of recent block tx's for AlreadyHave() check (Suhas Daftuar)

Pull request description:

  In order to determine whether to download or process a relayed transaction, we first try to check whether we already have the transaction -- either in the mempool, in our filter of recently rejected transactions, in our orphan pool, or already confirmed in a block.

  Prior to this commit, the heuristic for checking whether a transaction was confirmed in a block is based on whether there's a coin cache entry corresponding to the 0- or 1-index vout of the tx. While that is a quick check, it is very imprecise (eg if those outputs were already spent in another block, we wouldn't detect that the transaction has already been confirmed) -- we can do better by just keeping a rolling bloom filter of the transactions in recent blocks, which will better capture the case of a transaction which has been confirmed and then fully spent.

  This should reduce the bandwidth that we waste by requesting transactions which will not be accepted to the mempool.

  To avoid relay problems for transactions which have been included in a recent block but then reorged out of the chain, we clear the bloom filter whenever a block is disconnected.

ACKs for top commit:
  MarcoFalke:
    re-ACK a029e18c2b only stylistic and comment fixups 🍴
  sipa:
    utACK a029e18c2bf67dd00552b0f4bbc85fa2fa5b973b
  jonatack:
    Code review ACK a029e18c2bf67dd00552b0f4bbc85fa2fa5b973b also built/ran tests and am running bitcoind with mempool debug logging and custom logging. Looked a bit into CRollingBloomFilter and also the mempool median time past checks mentioned above; I don't have a deep understanding of those areas yet but the concept here and changes LGTM. Tests and other optimisations could be added as a follow-up. In favor of seeing this move forward if no major immediate concerns.

Tree-SHA512: 784c9a35bcd3af5db469063ac7d26b4bac430e451e5637a34d8a538c3ffd1433abdd3f06e5584e7a84bfa9e791449e61819397b5a6c7890fa59d78ec3ba507b2
2022-10-16 13:06:40 -05:00
Wladimir J. van der Laan
9ea098413a Merge #16908: txmempool: Make entry time type-safe (std::chrono)
faec689bed7a5b66e2a7675853d10205b933cec8 txmempool: Make entry time type-safe (std::chrono) (MarcoFalke)
faaa1f01daba94b021ca77515266a16d27f0364e util: Add count_seconds time helper (MarcoFalke)
1111170f2f0141084b5b4ed565b2f07eba48599a test: mempool entry time is persisted (MarcoFalke)

Pull request description:

  This changes the type of the entry time of txs into the mempool from `int64_t` to `std::chrono::seconds`.

  The benefits:
  * Documents the type for developers
  * Type violations result in compile errors
  * After compilation, the two are equivalent (at no run time cost)

ACKs for top commit:
  ajtowns:
    utACK faec689bed7a5b66e2a7675853d10205b933cec8
  laanwj:
    ACK faec689bed7a5b66e2a7675853d10205b933cec8

Tree-SHA512: d958e058755d1a1d54cef536a8b30a11cc502b7df0d6ecf84a0ab1d38bc8105a67668a99cd5087a444f6de2421238111c5fca133cdf8e2e2273cb12cb6957845
2022-10-03 16:08:31 -04:00
Kittywhiskers Van Gogh
0e58b340e6 merge bitcoin#19107: Move all header verification into the network layer, extend logging 2022-09-24 08:51:05 +05:30
Kittywhiskers Van Gogh
a35245653c
refactor: pass references to objects instead of using global definitions (#4988)
* fix: move chain activation logic downward to succeed LLMQ initialization

* fix: change order of initialization to reflect dependency

* llmq: pass all global pointers invoked as CDSNotificationInterface arguments

* llmq: pass reference to quorumDKGDebugManager instead of invoking global

* llmq: pass reference to quorumBlockProcessor instead of invoking global

* llmq: pass reference to quorumDKGSessionManager instead of invoking global

* llmq: pass reference to quorumManager instead of invoking global

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

* llmq: pass reference to quorumSigSharesManager within CSigningManager and networking

* llmq: pass reference to quorumSigSharesManager instead of invoking global

* llmq: pass reference to chainLocksHandler instead of querying global

* llmq: pass reference to quorumInstantSendManager instead of querying global

* trivial: accept argument as const where possible

* style: remove an unneeded const_cast and instead pass by const reference

* style: use const where possible

Co-authored-by: pasta <pasta@dashboost.org>
2022-09-22 15:14:48 +04:00
Kittywhiskers Van Gogh
71e8caf4b9
refactor: migrate globals to managed pointers in preparation for deglobalization (#4930)
* coinjoin: make CCoinJoinServer managed pointer, assign CConnman during init

* coinjoin: make CCoinJoinClientQueueManager managed pointer, assign CConnman during init

* sporks: move spork validation logic downwards after CConnman initialization

* sporks: make CSporkManager a pointer, reduce global invocations

* governance: make CGovernanceManager a pointer, reduce global invocations

* llmq: migrate LLMQ subsystem raw pointers to managed pointers

* masternode: make activeMasternodeManager a managed pointer

* masternode: make masternodeSync a managed pointer, assign CConnman during init

* refactor: make instantsend helper functions class members

* fix: send empty CDeterministicMNList if pointer isn't initialized yet

* fix: refactor governance object retrieval logic across node and ui

Update src/interfaces/node.cpp

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

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-08-26 16:52:53 -05:00
Kittywhiskers Van Gogh
bb7d6aed99
refactor(llmq): substitute memberless class llmq::CLLMQUtils with namespace llmq::utils (#4931)
* refactor(llmq): substitute memberless class llmq::CLLMQUtils with namespace llmq::utils

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

* chore: mark functions internal to `llmq::utils` as `static`

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-08-02 12:14:25 -05:00
UdjinM6
17b15efd61
fix(dkg/net): Drop outdated connections to nodes that became masternodes recently (#4934)
* feat: switch nTimeFirstMessageReceived from microseconds to seconds

Was acting more like a bool until now, so nothing should change really. Align it with nTimeConnected.

* fix(dkg/net): Drop outdated connections to nodes that became masternodes recently

Such nodes won't be seen as masternodes by RelayInvToParticipants otherwise so no contributions will be sent to them when they are picked as relay members which in its turn may result in other nodes PoSe-punishing us.
2022-07-26 00:36:17 +03:00
UdjinM6
1f161e520d
fix: Handle quorum watch connections correctly (#4933)
We add them via EnsureQuorumConnections+ThreadOpenMasternodeConnections so they are clearly masternode connections and they are dropped regularly which is annoying. But also, we don't want every masternode connection to be a qwatch one, we want only the ones we added via that algo.
2022-07-26 00:35:45 +03:00
UdjinM6
a483122f5f
fix(net): Extend blocks-relay-only to also ignore some Dash-specific messages/invs (#4888)
* fix(net): Extend blocks-relay-only to also ignore some Dash-specific messages/invs

* Clarify few things
2022-07-07 18:11:38 +03:00
MarcoFalke
4d6f0cd2f2
Merge #18530: Add test for -blocksonly and -whitelistforcerelay param interaction
0ea5d70b4756f376342417e0019490233cb4a918 Updated comment for the condition where a transaction relay is denied (glowang)
be01449cc8eb7bb97531a967f5d1dcc7b8865d1e Add test for param interaction b/w -blocksonly and -whitelistforcerelay (glowang)

Pull request description:

  Related to: #18428

  When -blocksonly is turned on, a node would still relay transactions from whitelisted peers. This funcitonality has not been tested.

ACKs for top commit:
  MarcoFalke:
    ACK 0ea5d70b4756f376342417e0019490233cb4a918

Tree-SHA512: 4e99c88281cb518cc67f5f3be7171a7b413933047b5d24a04bb3ff2210a82e914d69079f64cd5bac9206ec435e21a622c8e69cedbc2ccb39d2328ac5c01668e5
2022-06-29 10:14:58 -05:00
UdjinM6
d9c70e2916
llmq: Various fixes and improvements (#4890)
* feat(llmq): Introduce useRotation in LLMQParams

* fix(llmq): Fix IsQuorumRotationEnabled to recognize all dip0024 quorums

* fix(llmq): Do not allow rotation llmqs for `-llmqinstantsend` and non-rotation ones for `-llmqinstantsenddip0024`

* fix(llmq): Unify and fix IsMiningPhase

NOTE: no need for 1 extra block in mining phase for rotation quorums

* chore(llmq): Reduce the number of IsQuorumRotationEnabled calls

* chore(llmq): Improve logging

* feat(llmq): Make `llmq-` threads for rotation quorums distinguishable by quorum index

* fix(llmq): Fix another endless loop in GetQuorumRelayMembers

* throw an error when a llmq type with an incompatible rotation flag is picked for `-llmq...` params

* Add a note about loop conditions

* llmq: Make TransactionRemovedFromMempool the last action for invalid txes, just like we do for orphans with rejected parents

Write to log, send reject msg and (maybe) punish first and only then notify IS about the tx removal. Makes it easier to reason about it when reading logs.
2022-06-27 13:02:46 +03:00
UdjinM6
b9b60b02c6
chore: no scriptPayout and scriptOperatorPayout by default in protx diff / CSimplifiedMNListEntry (#4895) 2022-06-27 13:01:52 +03:00
PastaPastaPasta
f7f70d61de
feat: add scriptPayout and scriptOperatorPayout to protx diff / CSimplifiedMNListEntry (#4740)
* feat: add scriptPayout and scriptOperatorPayout to `protx diff` / CSimplifiedMNListEntry

* mem-only

* tweak BuildSimplifiedDiff

* add "extended" to "protx diff"

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-06-24 21:35:23 +03:00
Kittywhiskers Van Gogh
a7ee2c2667 merge bitcoin#19219: Replace automatic bans with discouragement filter
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-06-21 19:11:49 +05:30
Kittywhiskers Van Gogh
f14bf83a9d merge bitcoin#15141: Rewrite DoS interface between validation and net_processing
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-06-21 19:11:26 +05:30
Konstantin Akimov
ef3f738f6f
Merge bitcoin#15759: p2p: Add 2 outbound block-relay-only connections (#4862)
* Remove unused variable

* [refactor] Move tx relay state to separate structure

* [refactor] Change tx_relay structure to be unique_ptr

* Check that tx_relay is initialized before access

* Add comment explaining intended use of m_tx_relay

* Add 2 outbound block-relay-only connections

Transaction relay is primarily optimized for balancing redundancy/robustness
with bandwidth minimization -- as a result transaction relay leaks information
that adversaries can use to infer the network topology.

Network topology is better kept private for (at least) two reasons:

(a) Knowledge of the network graph can make it easier to find the source IP of
a given transaction.

(b) Knowledge of the network graph could be used to split a target node or
nodes from the honest network (eg by knowing which peers to attack in order to
achieve a network split).

We can eliminate the risks of (b) by separating block relay from transaction
relay; inferring network connectivity from the relay of blocks/block headers is
much more expensive for an adversary.

After this commit, bitcoind will make 2 additional outbound connections that
are only used for block relay. (In the future, we might consider rotating our
transaction-relay peers to help limit the effects of (a).)

* Don't relay addr messages to block-relay-only peers

We don't want relay of addr messages to leak information about
these network links.

* doc: improve comments relating to block-relay-only peers

* Disconnect peers violating blocks-only mode

If we set fRelay=false in our VERSION message, and a peer sends an INV or TX
message anyway, disconnect. Since we use fRelay=false to minimize bandwidth,
we should not tolerate remaining connected to a peer violating the protocol.

* net_processing. Removed comment + fixed formatting

* Refactoring net_processing, removed duplicated code

* Refactor some bool in a many-arguments function to enum

It's made to avoid possible typos with arguments, because some of them have default values and it's very high probability to make a mistake here.

* Added UI debug option for Outbound

* Fixed data race related to `setInventoryTxToSend`, introduced in `[refactor] Move tx relay state to separate structure`

Co-authored-by: Suhas Daftuar <sdaftuar@gmail.com>
2022-06-18 23:02:28 -07:00
UdjinM6
cfbc38c185
dashification: Introduce ADDRV2_PROTO_VERSION and bump PROTOCOL_VERSION to avoid conflicts with previous v18.x rcs 2022-06-08 02:53:55 +03:00
Wladimir J. van der Laan
b0d655216b
Merge #20661: Only select from addrv2-capable peers for torv3 address relay
37fe80e6267094f6051ccf9bec0c7f1a6b9e15da Only consider addrv2 peers for relay of non-addrv1 addresses (Pieter Wuille)
83f8821a6f41854edd5c0b11deabba658890cde1 refactor: add IsAddrCompatible() to CNode (Pieter Wuille)

Pull request description:

  When selecting peers to relay an address to, only pick addrv2-capable ones if the address cannot be represented in addr(v1).

  Without this I expect that propagation of torv3 addresses over the cleartext network will be very hard for a while.

ACKs for top commit:
  jonatack:
    ACK 37fe80e6267094f6051ccf9bec0c7f1a6b9e15da
  vasild:
    ACK 37fe80e6267094f6051ccf9bec0c7f1a6b9e15da

Tree-SHA512: 18a854ea43ad473cf89b9c5193b524109d7af75c26f7aa7e26cd72ad0db52f19c8001d566c607a7e6772bc314f770f09b6c3e07282d110c5daea193edc592cd2
2022-06-08 02:41:31 +03:00
MarcoFalke
7b2026e49b
Merge #20564: Don't send 'sendaddrv2' to pre-70016 software, and send before 'verack'
1583498fb6781c01ca2f33c09319ed793964c574 Send and require SENDADDRV2 before VERACK (Pieter Wuille)
c5a89196602e43ebb1cdc9cd4f08d153419c13e1 Don't send 'sendaddrv2' to pre-70016 software (Pieter Wuille)

Pull request description:

  BIP155 defines addrv2 and sendaddrv2 for all protocol versions, but some implementations reject messages they don't know. As a courtesy, don't send it to nodes with a version before 70016, as no software is known to support BIP155 that doesn't announce at least that protocol version number.

  Also move the sending of sendaddrv2 earlier (before sending verack), as proposed in https://github.com/bitcoin/bips/pull/1043. This has the side effect that local address broadcast of torv3 will work (as it'll only trigger after we know whether or not the peer supports addrv2).

ACKs for top commit:
  MarcoFalke:
    ACK 1583498fb6781c01ca2f33c09319ed793964c574
  jnewbery:
    ACK 1583498fb6781c01ca2f33c09319ed793964c574
  jonatack:
    ACK 1583498fb6781c01ca2f33c09319ed793964c574
  vasild:
    ACK 1583498

Tree-SHA512: 3bd5833fa8c8567b6dedd99e4a9b6bb71c127aa66d5284b217503c86d597dc59aa7382c41f3a4bf561bb658b89db81d1a7703a700eef4ffc17cb916660e23a82
2022-06-08 02:41:28 +03:00
Wladimir J. van der Laan
d413109da5 Merge #13558: Drop unused GetType() from CSizeComputer
893628be0166b4096b6e52f516e0f65bb63a75a2 Drop minor GetSerializeSize template (Ben Woosley)
da74db0940720407fafaf3582bbaf9c81a4d3b4d Drop unused GetType() from CSizeComputer (Ben Woosley)

Pull request description:

  Based on conversation in #13462, it seems the serialization `GetType` has very narrow use/effect. In every case except for `CAddress`, which specifically relates to a network peer's address, not a wallet address etc., the serialized representation of an object is irrespective of its destination / type.

  This removes the unused `GetType` method from `CSizeComputer` as a step to further narrowing that use.

Tree-SHA512: e72b8e9e5160396691e05aeaee3aba5a57935a75bd5005cfcc7fb51c936f3d1728a397f999da5c36696506dd815fafa5c738f3894df8864f25f91f639eba9c3d
2022-05-30 01:11:03 -04:00
Kittywhiskers Van Gogh
faaf840016 partial bitcoin#19204: Reduce inv traffic during IBD 2022-05-23 10:40:35 +05:30
Kittywhiskers Van Gogh
761305d44d merge bitcoin#18698: Make g_chainman internal to validation 2022-05-18 20:53:41 +05:30
Kittywhiskers Van Gogh
a250f2c977 merge bitcoin#14193: Add missing mempool locks
Co-authored-by: "UdjinM6 <UdjinM6@users.noreply.github.com>"
2022-05-18 20:49:34 +05:30
Kittywhiskers Van Gogh
6390cae926 merge bitcoin#18038: Mempool tracks locally submitted transactions to improve wallet privacy 2022-05-18 20:49:34 +05:30
Kittywhiskers Van Gogh
e5897baf30 partial bitcoin#19277: Add Assert identity function'
Excludes fa34587f1c811d99200453b0936219c473f514b0 and fab80fef61ddd4afeff6e497c7e76bffcd05e8a4
2022-05-13 18:06:06 +05:30
Kittywhiskers Van Gogh
41252a1de2 merge bitcoin#17997: Remove mempool global from net 2022-04-20 00:25:14 +05:30
Kittywhiskers Van Gogh
f0263a3629 partial bitcoin#17989: Add fuzzing harness for ProcessMessage(...). Enables high-level fuzzing of the P2P layer
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-04-20 00:24:10 +05:30
Kittywhiskers Van Gogh
b3b636463e merge bitcoin#16839: Replace Connman and BanMan globals with NodeContext local
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-04-20 00:22:35 +05:30
Vijay
c66a2ec6fd
scripted-diff: Merge #18533 Replace strCommand with msg_type (#4761)
-BEGIN VERIFY SCRIPT-
sed -i 's/\<strCommand\>/msg_type/g' src/coinjoin/client.cpp
sed -i 's/\<strCommand\>/msg_type/g' src/coinjoin/client.h
sed -i 's/\<strCommand\>/msg_type/g'  src/coinjoin/server.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/coinjoin/server.h
sed -i 's/\<strCommand\>/msg_type/g'  src/evo/mnauth.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/evo/mnauth.h
sed -i 's/\<strCommand\>/msg_type/g'  src/governance/governance.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/governance/governance.h
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/blockprocessor.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/blockprocessor.h
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/chainlocks.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/chainlocks.h
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/dkgsessionhandler.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/dkgsessionhandler.h
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/dkgsessionmgr.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/dkgsessionmgr.h
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/instantsend.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/instantsend.h
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/quorums.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/quorums.h
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/signing.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/signing.h
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/signing_shares.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/llmq/signing_shares.h
sed -i 's/\<strCommand\>/msg_type/g'  src/masternode/sync.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/masternode/sync.h
sed -i 's/\<strCommand\>/msg_type/g'  src/net_processing.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/spork.cpp
sed -i 's/\<strCommand\>/msg_type/g'  src/spork.h
-END VERIFY SCRIPT-
2022-04-18 11:47:26 -05:00
Odysseas Gabrielides
83ef1c6c66
feat: implement quorum rotation and updated LLMQ parameters (#4752)
* Added GET_SNAPSHOT_INFO message handling

* Quorum members by rotation

* Quorum utils functions

* Handle GET_QUORUM_ROTATION_INFO with baseBlockHash from client

* Storing QuorumSnaphots in evoDB when requesting them

* Added DIP Enforcement param

* quorumIndex cache

* Quorum Rotation deployment control

* Usage of Bitsets for storing CQuorumSnapshots

* Correct handling of early quorum quarters

* More asserts

* Corrections

* Handling of quorumIndex

* Refactoring of truncate mechanism

* Various fixes

* Interface correction

* Added template type for indexed cache

* Added quorumIndex into commitmenHash

* Various changes

* Needs to update maqQuorumsCache along with indexedQuorumsCache

* Added CFinalCommitment version 2

* Renamed variables

* Fixes

* Refactoring & correct caching of quorumMembers by rotation

* Added assertions

* Refactoring

* Interface change

* Handling of previous DKG session failure

* Applied refactoring

* Build quarter members improvments

* Merge Quorum Rotation and Decreased fee into one deployment (DIP24)

* Added new LLMQ Type

* Added functional tests + refactoring

* Refactoring

* Spreaded Quorum creation and Quorum Index adaptation

* quorumIndex adaptations

* Added quorumIndex in CFinalCommitment

* Latest work

* Final refactoring

* Batch of refactoring

* Fixes for tests

* Fix for CFinalCommitment

* Fix for Quorums

* Fix

* Small changes

* Thread sync fic

* Safety changes

* Reuse mns when needed

* Refactoring

* More refactoring

* Fixes for rotationinfo handling

* Fix for rotation of members

* Correct order of MNs lists in Quorum Snapshots

* Adding extra logs

* Sync rotation quorums + qrinfo changes

* Fix + extra logs

* Removed redundant field

* Fix for null final commitment + refactoring

* Added timers in tests

* Fix for qrinfo message: quorumdiff and merkleRootQuorums

* Small changes for rotation test

* Remove reading from scanQuorumCache

* Added quorum list output

* Crash fix

* Experimental commit

* apply changes to specialtxman.cpp from specialtx.cpp

* all the changes

* substancially speed up feature_llmq_rotation.py

* reenable asserts, add check for reorgs

* Refactoring

* Added extra logs

* format

* trivial

* drop extra boost includes

* drop ContainsMN

* fix ScanQuorums

* check quorum hash and index in CFinalCommitment::Verify

* fix/tweak tests

* IsQuorumRotationEnabled should be aware of the context

* Calculating members based on earlier block.

* Fix for Quorum Members Cache

* Removed duplicate size of baseBlockHashes

* Adaptations of qrinfo to -8 mn lists

* Introduction of llmqTypeDIP24InstantSend

* Adaptation for llmqTypeDIP24InstantSend

* Adaptations for IS

* bump protocol version

* Added feature_llmq_is_migration test

* Various cleanups

* use unordered_lru_cache for quorumSnapshotCache

* trivial refactor ComputeQuorumMembersByQuarterRotation

* Reduced CFinalCommitment::quorumIndex from 32 to 16 bits

* Keep verified LLMQ relay connections

* Experimental Relay connection fix

* Fix for EnsureQuorumConnections rotation

* Using only valid Mns for checking

* Override of nPowTargetSpacing (devnet only)

* Show penalty score in masternode rpc

* fixups

* Rotation refactoring

* Update src/chainparams.cpp

* Replaced LogPrintf with LogPrint

* IS locking fix once DIP24 activation

* Various cleanup

* Updated MIN_MASTERNODE_PROTO_VERSION

* Introduce LLMQ_TEST_INSTANTSEND reg-test only quorum and actually test switching to dip0024 quorums

* Renamed field lastQuorumHashPerIndex

* Renamed to DIP0024

* chore: update nStartTime and nTimeout for mainnet / testnet for DEPLOYMENT_DIP0024

Co-authored-by: Kittywhiskers Van Gogh <63189531+kittywhiskers@users.noreply.github.com>
Co-authored-by: pasta <pasta@dashboost.org>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-04-16 17:46:04 +03:00
PastaPastaPasta
6b9f7c3a6b
chore: bump MIN_PEER_PROTO_VERSION to 70215 (#4764)
* chore: bump MIN_PEER_PROTO_VERSION to 70215

simplifies logic, removes branches

This protocol version is from v14 in May of 2019, should be more than safe to bump this

* drop MIN_COINJOIN_PEER_PROTO_VERSION

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-04-12 21:03:12 +03:00
PastaPastaPasta
3c0ffa5c73
refactor: fixup changes related to PR#4713 (#4747) 2022-04-06 00:39:13 +03:00
rkarthik2k21
fee6ed20a4
Add function to validate DSTX message (#4713)
* Add function to validate DSTX message

* Addressed review comment: Remove text left due to merge

* Apply suggestions from code review

* Update src/net_processing.cpp

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-04-01 20:02:24 -05:00
gabriel-bjg
52ddf5c453
Compressed headers implementation. (#4497)
* Compressed headers implementation.

First header is always compressed in a headers2 msg
Version is uncompressed if it’s not matched within the last 7 unique versions to be sent in the current msg
Service flag to signal that the peer supports compressed headers
If compressed headers services is active, the peer will receive headers compressed
If both sendheaders and sendheaders2 are sent, the peer will respond with compressed headers
Functional tests as for uncompressed headers
Updates regarding the existing functional tests to use the compressed headers if the NODE_HEADERS_COMPRESSED service flag is active

* style: add missing comma

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-03-11 22:39:12 +03:00
Odysseas Gabrielides
64f7a1e291
Revert "feat: introduce devnetVersion for devnet breaking changes; always use DGW on devnets (#4685)" (#4712)
This reverts commit a3b4aab936.
2022-02-28 10:43:00 -06:00
PastaPastaPasta
a3b4aab936
feat: introduce devnetVersion for devnet breaking changes; always use DGW on devnets (#4685)
* feat: introduce devnetVersion as a method for breaking changes to devnets

include devnetVersion in expected version for devnet connections

* feat: always use DGW on devnets

* fix p2p_connect_to_devnet.py

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-02-13 11:44:49 +03:00
PastaPastaPasta
fe0ebb3c04
refactor: fix numerous compilation warnings (#4682)
* style: use clang-tidy style named parameters

* refactor: make IsTimeOutOfBounds testable by having current time be a parameter

* style: use x-> not (*x).

* refactor: make SelectCoinsGroupedByAddresses return a vector, remove out param

previous semantics was return false if the vecTally vector was empty. Now we just let the caller check if it is empty or not

* refactor: fix some sign-compare warnings

* refactor: consistently pre-declare stuff as struct / class inline with underlying type

* refactor: don't return const bool

* refactor: use ref to string

* refactor: use = default for CompactTallyItem

* refactor: adjust "initialization" ordering

* refactor: adjust how we handle negatives in GetProjectedMNPayees, use std::min

* refactor: don't bind a reference to a temporary value

* refactor: use a ref

* refactor: ensure attempt in SelectMemberForRecovery is non-negative.

* refactor: remove unused this capture

* refactor: fix numerous sign-compare warnings

* refactor: more consistently use size_t, use empty()
2022-02-11 19:15:26 +03:00
PastaPastaPasta
8ef0231166
refactor: break circular dependencies(-16, +2) (#4670)
* refactor: break circular dependencies(-13, +2)

introduces specialtxman, which handles validation of special transactions, specialtx is now simply the primitive underlying type. This breaks a lot of the circular depends

Also removes an unneeded `#include <masternode/payments.h>` in net_processing.cpp, which resolves a circular dependency. (we know it's okay to remove b/c masternode/payments.h isn't included in any header files, and removing it doesn't break compilation)

* format: make clang-format happy

* remove unrelated change

* remove some unneeded includes to `evo/deterministicmns.h`, explicitly include some previously implicitly included includes.

Resolves two circular dependencies

* refactor: remove circular depend, unused include
2022-01-24 17:20:50 +03:00
Vijay Manikpuri
3148450032
Merge #16129: refactor: Remove unused includes (#4623)
67f4e9c522 Include core_io.h from core_read.cpp (practicalswift)
eca9767673 Make reasoning about dependencies easier by not including unused dependencies (practicalswift)

Pull request description:

  Make reasoning about dependencies easier by not including unused dependencies.

  Please note that the removed headers are _not_ "transitively included" by other still included headers. Thus the removals are real.

  As an added bonus this change means less work for the preprocessor/compiler. At least 51 393 lines of code no longer needs to be processed:

  ```
  $ git diff -u HEAD~1 | grep -E '^\-#include ' | cut -f2 -d"<" | cut -f1 -d">" | \
        sed 's%^%src/%g' | xargs cat | wc -l
  51393
  ```

  Note that 51 393 is the lower bound: the real number is likely much higher when taking into account transitively included headers :-)

ACKs for commit 67f4e9:

Tree-SHA512: 0c8868aac59813f099ce53d5307eed7962dd6f2ff3546768ef9e5c4508b87f8210f1a22c7e826c3c06bebbf28bdbfcf1628ed354c2d0fdb9a31a42cefb8fdf13

Co-authored-by: MarcoFalke <falke.marco@gmail.com>
2022-01-03 13:10:02 -06:00
Kittywhiskers Van Gogh
7e1e800aaa merge bitcoin#16452: use RelayTransaction in BroadcastTransaction utility 2021-12-22 19:43:18 +05:30
Kittywhiskers Van Gogh
c46306a1df merge bitcoin#15652: Update transactions with current mempool after load
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-12-22 19:41:11 +05:30
PastaPastaPasta
72e1d79fb8
refactor: misc spork refactoring (#4620)
* Use string_view instead of string for SERIALIZATION_VERSION_STRING. Also introduces string_view serialization. Also use string_view where (trivially) possible for params

* separate GetSporks and sporks net msg processing into its own method

* refactor: spork, use c++17 if-init

* refactor: spork, remove unused params, make param pt

* refactor: spork, use simplier construction

* refactor: spork, make strError part of if-init, also w/o redundant initialization

* refactor: spork, use structured binding

* refactor: spork, use for instead of while

* clang-format: spork.cpp

* resolve cppcheck linter warning about unused variable
2021-12-17 20:22:11 +03:00
UdjinM6
5bdd245105
Merge pull request #4619 from PastaPastaPasta/remove-includes
refactor: Remove includes; backport 16659
2021-12-17 20:21:12 +03:00
pasta
f04cf7bf47
16659 continuation
Signed-off-by: pasta <pasta@dashboost.org>
2021-12-17 12:02:16 -05:00
Wladimir J. van der Laan
452d182739
Merge #14696: qa: Add explicit references to related CVE's in p2p_invalid_block test.
0c62e3aa73839e97e65a3155e06a98d84b700a1e New regression testing for CVE-2018-17144, CVE-2012-2459, and CVE-2010-5137. (lucash-dev)
38bfca6bb2ad68719415e9c54a981441052da072 Added comments referencing multiple CVEs in tests and production code. (lucash-dev)

Pull request description:

  This functional test includes two scenarios that test for regressions of vulnerabilities, but they are only briefly described. There are freely available documents explaining in detail the issues, but without explicit mentions, the developer trying to maintain the code needs an additional step of digging in commit history and PR conversations to figure it out.
  Added comments to explicitly mention  CVE-2018-17144 and CVE-2012-2459, for more complete documentation.
  This improves developer experience by making understanding the tests easier.

ACKs for top commit:
  laanwj:
    ACK 0c62e3aa73839e97e65a3155e06a98d84b700a1e, checked the CVE numbers, thanks for adding documentation

Tree-SHA512: 3ee05351745193b8b959e4a25d50f25a693b2d24b0732ed53cf7d5882df40b5dd0f1877bd5c69cffb921d4a7acf9deb3cc1160b96dc730d9b5984151ad06b7c9
2021-12-15 20:09:58 +05:30
MarcoFalke
3c5dcb036a Merge #16659: refactoring: Remove unused includes
084e17cebd424b8e8ced674bc810eef4e6ee5d3b Remove unused includes (practicalswift)

Pull request description:

  As requested by MarcoFalke in https://github.com/bitcoin/bitcoin/pull/16273#issuecomment-521332089:

  This PR removes unused includes.

  Please note that in contrast to #16273 I'm limiting the scope to the trivial cases of pure removals (i.e. no includes added) to make reviewing easier.

  I'm seeking "Concept ACK":s for this obviously non-urgent minor cleanup.

  Rationale:
  * Avoids unnecessary re-compiles in case of header changes.
  * Makes reasoning about code dependencies easier.
  * Reduces compile-time memory usage.
  * Reduces compilation time.
  * Warm fuzzy feeling of being lean :-)

ACKs for top commit:
  ryanofsky:
    Code review ACK 084e17cebd424b8e8ced674bc810eef4e6ee5d3b. PR only removes include lines and it still compiles. In the worst case someone might have to explicitly add an include later for something now included implicitly. But maybe some effort was taken to avoid this, and it wouldn't be a tragedy anyway.

Tree-SHA512: 89de56edc6ceea4696e9579bccff10c80080821685b9fb4e8c5ef593b6e43cf662f358788701bb09f84867693f66b2e4db035b92b522a0a775f50b7ecffd6a6d
2021-12-12 16:44:54 -05:00
Kittywhiskers Van Gogh
ed48a889bf merge bitcoin#15632: Remove ResendWalletTransactions from the Validation Interface 2021-12-12 21:27:51 +05:30
UdjinM6
3b8b3e254a
instantsend: Do not consider islocks with unknown txes as complete (#4147)
* instantsend: Avoid writing IS locks for unknown txes

* instantsend: Allow a competing tx into mempool if there is an islock waiting for it

* use try_emplace

* Hold cs_main while calling ResetBlockFailureFlags
2021-11-30 14:14:08 +03:00
Wladimir J. van der Laan
d21e550b0e Merge #16021: p2p: Avoid logging transaction decode errors to stderr
fa2b52af32f6a4b9c22c270f36e92960c29ef364 Disallow extended encoding for non-witness transactions (take 3) (MarcoFalke)

Pull request description:

  (previous title "p2p: Disallow extended encoding for non-witness transactions (take 3)")

  Remote peers can send us illegally encoded txs and thus have us write to stderr. Fix that by not writing to stderr.

  This is a follow up to the previous (incomplete) attempts at this:

  *  Disallow extended encoding for non-witness transactions #14039
  *  Add test for superfluous witness record in deserialization #15893

ACKs for commit fa2b52:
  laanwj:
    utACK fa2b52af32f6a4b9c22c270f36e92960c29ef364
  ryanofsky:
    utACK fa2b52af32f6a4b9c22c270f36e92960c29ef364. Would change title to something like "Avoid logging transaction decode errors to stderr" instead of "Disallow extended encoding for non-witness transactions." The current title is confusing because this PR isn't really allowing or disallowing anything, just logging the condition differently. "Disallow" also seems to contradict the "Allow exceptions from..." comments in the actual code.

Tree-SHA512: c66990e69b432d00dc1c5510bf976a1188664d0890a32d1e5c6459094e7e27da82a5d227627afcbc203676f5540eec74b7d9b1d71d2c62d3b2069e1781824b4d
2021-11-18 12:12:55 -05:00
Wladimir J. van der Laan
47714ab3b7
Merge #16847: doc: add comments clarifying how local services are advertised
82e53f37e1bfa6e34eac16b33329d70c3c0127da doc: add comments clarifying how local services are advertised (James O'Beirne)

Pull request description:

  Recent questions have come up regarding dynamic service registration
  (see https://github.com/bitcoin/bitcoin/pull/16442#discussion_r308702676
  and the assumeutxo project ~~which needs to dynamically flip NODE_NETWORK~~).

  While investigating how dynamic service registration might work, I was
  confused about how we convey local services to peers. This adds some
  documentation that hopefully clarifies this process.

ACKs for top commit:
  laanwj:
    ACK 82e53f37e1bfa6e34eac16b33329d70c3c0127da
  darosior:
    ACK 82e53f37e1bfa6e34eac16b33329d70c3c0127da

Tree-SHA512: a30c1020387d7a75b5b3cdde45f8b7f2ae46293da97e6227b2ee17e290b93deb5b16c0bbc2b1676972300e5c3c2ad74eb8b3910d6b93e028dac1ae2700468ef9
2021-11-16 07:13:49 +05:30
Kittywhiskers Van Gogh
c0d4df0a06 merge bitcoin#16202: Refactor network message deserialization
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-11-03 10:45:00 +05:30
Kittywhiskers Van Gogh
84339a4b84 merge bitcoin#16443: have CCoins* data managed under CChainState 2021-10-22 08:15:38 +05:30
Kittywhiskers Van Gogh
900c0100eb merge bitcoin#16092: Don't use global (external) symbols for symbols that are used in only one translation unit 2021-10-22 08:15:38 +05:30
Kittywhiskers Van Gogh
1bb1cea5c9 merge bitcoin#15976: move methods under CChainState
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-10-22 08:15:38 +05:30
Kittywhiskers Van Gogh
1f436f8aee merge bitcoin#15948: rename chainActive
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-10-22 08:15:22 +05:30
Kittywhiskers Van Gogh
f22be5a16b refactor: llmq/quorums_*[cpp/h] --> llmq/*.[cpp/h] 2021-10-06 09:04:45 +05:30
gabriel-bjg
b4d001a602
instantsend: deterministic lock using the same msg hash as islock (#4381)
When receiving an islock, propagate it as islock.
When creating/receiving and isdlock, propagate it as isdlock to peers which support it and as islock to peers which don't.
Functional tests to cover both islock and isdlock scenarios.
2021-10-05 20:42:34 +03:00
Kittywhiskers Van Gogh
cb1d4766f5
refactor: remove redundant filename prefixes for Dash-specific logic (#4475)
* refactor: coinjoin/coinjoin-*[cpp/h] --> coinjoin/*.[cpp/h]

* refactor: governance/governance-*[cpp/h] --> governance/*.[cpp/h]

* refactor: masternode/masternode-*[cpp/h] --> masternode/*.[cpp/h]

* fix linter

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-10-01 22:19:08 +03:00
PastaPastaPasta
9da186bb61
refactor: Various small improvements (#4471)
* bls: use constexpr int instead of #define

* lint: bump c++ version to 17

* test: use BOOST_CHECK_EQUAL instead of BOOST_ASSERT, call boost assert in another location

* coinjoin: fix typo

* drop redundant LLMQType cast

* use numeric_limits instead of magic value

* net_processing.cpp whitespace fixes

* Add some const

* use std::all_of instead of raw for loop

* Introduce UNINITIALIZED_SESSION_ID and use it instead of a magic number

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-10-01 14:44:40 +03:00
UdjinM6
2d1b13bd90
Merge pull request #4435 from PastaPastaPasta/backport-trivial-pr20
Backport trivial pr20
2021-09-24 23:10:10 +03:00
MarcoFalke
fbf6c930b2
Merge #20212: net: fix output of peer address in version message
af3b0dfc5463c42fb9bff39f020fc1728ed44bc7 net: fix output of peer address in version message (Vasil Dimov)

Pull request description:

  If `-logips -debug=net` is specified then we print the contents of the
  version message we send to the peer, including his address. Because the
  addresses in the version message use pre-BIP155 encoding they cannot
  represent a Tor v3 address and we would actually send 16 `0`s instead (a
  dummy IPv6 address). However we would print the full address in the log
  message. Before this fix:

  ```
  2020-10-21T12:24:17Z send version message: version 70016, blocks=653500, us=[::]:0, them=xwjtp3mj427zdp4tljiiivg2l5ijfvmt5lcsfaygtpp6cw254kykvpyd.onion:8333, peer=0
  ```

  This is confusing because we pretend to send one thing while we actually
  send another. Adjust the printout to reflect what we are sending. After
  this fix:

  ```
  2020-10-21T12:26:54Z send version message: version 70016, blocks=653500, us=[::]:0, them=[::]:0, peer=0
  ```

ACKs for top commit:
  MarcoFalke:
    review ACK af3b0dfc5463c42fb9bff39f020fc1728ed44bc7
  jnewbery:
    utACK af3b0dfc5463c42fb9bff39f020fc1728ed44bc7

Tree-SHA512: f169d7b4f07c219e541f7c37ea23b82c77e50085fc72ec62f1dd46970389916e177268d07d45c7be94dd209d1903f8f23eaff62b7fa782f6057dd36bb96bba82
2021-09-24 13:26:40 -04:00
Kittywhiskers Van Gogh
c7f08018d9 merge bitcoin#19070: Signal support for compact block filters with NODE_COMPACT_FILTERS 2021-09-19 10:05:59 +05:30
Kittywhiskers Van Gogh
5474c85853 merge bitcoin#19044: Add support for getcfilters 2021-09-19 10:05:58 +05:30
Kittywhiskers Van Gogh
216036b1af merge bitcoin#19010: Add support for getcfheaders 2021-09-19 10:05:23 +05:30
Kittywhiskers Van Gogh
5996dbe686 merge bitcoin#18960: Add compact block filter headers cache 2021-09-19 10:01:44 +05:30
Kittywhiskers Van Gogh
5b22d6d0ac merge bitcoin#18877: Serve cfcheckpt requests 2021-09-19 10:01:43 +05:30
PastaPastaPasta
592cd0a939
Merge pull request #4333 from Munkybooty/backports-0.18-pr13
Backports 0.18 pr13
2021-08-16 14:24:51 -05:00
Wladimir J. van der Laan
36efb7ec0d Merge #14863: refactor: Add and use HaveTxsDownloaded() where appropriate
fa4fc8856b239059421a8e507b3e3e7f4b379a72 validation: Add and use HaveTxsDownloaded where appropriate (MarcoFalke)

Pull request description:

  `nChainTx` is an implementation detail that shouldn't be exposed without a wrapper that comes with appropriate documentation.

Tree-SHA512: 56ab7378c2ce97794498724c271f861de982de69099e90ec09632a26230ae6fded3c59668adb378bd64dcb8ef714769b970210977b88a53fc7550774ddba3d59
2021-08-15 11:08:08 -04:00
PastaPastaPasta
39e34e2b52
Merge pull request #4334 from linuxsh2/bp-19
Backports v0.19 (16767, 16646, 16470, 16329, 16234, 16059, 15968, 15866, 15755, 15617, 15466, 15491)
2021-08-11 16:57:34 -05:00
Wladimir J. van der Laan
1818cb0256 Merge #15617: p2p: Do not relay banned IP addresses
054d01d0a87a5adc43428588ecc29f1339a69dd2 Do not relay banned IP addresses (Pieter Wuille)

Pull request description:

Tree-SHA512: 538c43781c789949e1ae566533e76835d478e40e8ba6427b22234ee611cb4a311b2940a214e37c1e9c9afe28a6814a00d490a39e3580bb5ebd85b03e95040246
2021-08-11 13:58:48 -04:00
PastaPastaPasta
a9bfde558a
Merge pull request #4313 from Munkybooty/backports-0.18-pr12
Backports 0.18 pr12
2021-08-11 11:11:35 -05:00
Kittywhiskers Van Gogh
91c84492a1 merge #17383: Move consts to their correct translation units 2021-08-09 12:38:00 +05:30
MarcoFalke
6fb718dc96 Merge #14436: doc: add comment explaining recentRejects-DoS behavior
b191c7dfb7 doc: add comment explaining recentRejects-DoS behavior (James O'Beirne)

Pull request description:

  When we receive invalid txs for the first time, we mark the sender as
  misbehaving. If we receive the same tx before a new block is seen, we *don't*
  punish the second sender (in the same way we do the original sender). It wasn't
  initially clear to me that this is intentional, so add a clarifying comment.

Tree-SHA512: d12c674db137ed3ad83e0b941bffe6ddcd2982238048742afa574a4235881f0e58cfc0a4a576a0503e74c5c5240c270b9520fa30221e8b43a371fb3e0b37066b
2021-07-28 20:21:29 -04:00
gabriel-bjg
41190e9899
Fix data races triggered by functional tests. (#4247)
Function CWallet::KeepKey requires locking as it has concurrent access to database and member nKeysLeftSinceAutoBackup.

Avoid data race when reading setInventoryTxToSend size by locking the read. If locking happens after the read, the size may change.

Lock cs_mnauth when reading verifiedProRegTxHash.

Make fRPCRunning atomic as it can be read/written from different threads simultaneously.

Make m_masternode_iqr_connection atomic as it can be read/written from different threads simultaneously.

Use a recursive mutex to synchronize concurrent access to quorumVvec.

Make m_masternode_connection atomic as it can be read/written from different threads simultaneously.

Make m_masternode_probe_connection atomic as it can be read/written from different threads simultaneously.

Use a recursive mutex in order to lock access to activeMasterNode.

Use a recursive mutex to synchronize concurrent access to skShare.

Guarded all mnauth fields of a CNode.

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-07-26 10:52:52 -05:00
Wladimir J. van der Laan
3cb8293ba5
Merge #15990: Add tests and documentation for blocksonly
fa8ced32a60dea37ac169241cf9a1f708ef46c4b doc: Mention blocksonly in reduce-traffic.md, unhide option (MarcoFalke)
fa320de79faaca2b088fcbe7f76701faa9bff236 test: Add test for p2p_blocksonly (MarcoFalke)
fa3872e7b4540857261aed948b94b6b2bfdbc3d1 test: Format predicate source as multiline on error (MarcoFalke)
fa1dce7329d3e74d46ab98b93772b1832a3f1819 net: Rename ::fRelayTxes to ::g_relay_txes (MarcoFalke)

Pull request description:

  This is de-facto no longer hidden

ACKs for commit fa8ced:
  jamesob:
    utACK fa8ced32a6

Tree-SHA512: 474fbdee6cbd035ed9068a066b6056c1f909ec7520be0417820fcd1672ab3069b53f55c5147968978d9258fd3a3933fe1a9ef8e4f6e14fb6ebbd79701a0a1245
2021-07-21 15:53:38 -05:00
UdjinM6
6696f45a32
Change devnet uacomment from devnet=<name> to devnet.<name> (#4282)
Backporting 15654 in 4213 broke devnet connections because of SanitizeString for cleanSubVer. The real issue is using unsafe character in devnet uacomments actually, so to fix this we should replace unsafe `=` with something safe e.g. `.`.
2021-07-20 15:34:33 +03:00
Wladimir J. van der Laan
9009f57e27 Merge #14624: Some simple improvements to the RNG code
e414486d56b9f06af7aeb07ce13e3c3780c2b69b Do not permit copying FastRandomContexts (Pieter Wuille)
022cf47dd7ef8f46e32a184e84f94d1e9f3a495c Simplify testing RNG code (Pieter Wuille)
fd3e7973ffaaa15ed32e5aeadcb02956849b8fc7 Make unit tests use the insecure_rand_ctx exclusively (Pieter Wuille)
8d98d426116f0178612f14d1874d331042c4c4b7 Bugfix: randbytes should seed when needed (non reachable issue) (Pieter Wuille)
273d02580aa736b7ccea8fce51d90541665fdbd1 Use a FastRandomContext in LimitOrphanTxSize (Pieter Wuille)
3db746beb407f7cdd9cd6a605a195bef1254b4c0 Introduce a Shuffle for FastRandomContext and use it in wallet and coinselection (Pieter Wuille)
8098379be5465f598220e1d6174fc57c56f9da42 Use a local FastRandomContext in a few more places in net (Pieter Wuille)
9695f31d7544778853aa373f0aeed629fa68d85e Make addrman use its local RNG exclusively (Pieter Wuille)

Pull request description:

  This improves a few minor issues with the RNG code:
  * Avoid calling `GetRand*()` functions (which currently invoke OpenSSL, later may switch to using our own RNG pool) inside loops in addrman, networking code, `KnapsackSolver`, and `LimitOrphanSize`
  * Fix a currently unreachable bug in `FastRandomContext::randbytes`.
  * Make a number of simplifications to the unit tests' randomness code (some tests unnecessarily used their own RNG or the OpenSSL one, instead of using the unit test specific `insecure_rand_ctx`).
  * As a precaution, make it illegal to copy a `FastRandomContext`.

Tree-SHA512: 084c70b533ea68ca7adc0186c39f0b3e0a5c0ae43a12c37286e5d42086e056a8cd026dde61b12c0a296dc80f87fdc87fe303b9e8e6161b460ac2086cf7615f9d
2021-07-19 19:00:04 -05:00
Wladimir J. van der Laan
6c75d20277 Merge #16248: Make whitebind/whitelist permissions more flexible
c5b404e8f1973afe071a07c63ba1038eefe13f0f Add functional tests for flexible whitebind/list (nicolas.dorier)
d541fa391844f658bd7035659b5b16695733dd56 Replace the use of fWhitelisted by permission checks (nicolas.dorier)
ecd5cf7ea4c3644a30092100ffc399e30e193275 Do not disconnect peer for asking mempool if it has NO_BAN permission (nicolas.dorier)
e5b26deaaa6842f7dd7c4537ede000f965ea0189 Make whitebind/whitelist permissions more flexible (nicolas.dorier)

Pull request description:

  # Motivation

  In 0.19, bloom filter will be disabled by default. I tried to make [a PR](https://github.com/bitcoin/bitcoin/pull/16176) to enable bloom filter for whitelisted peers regardless of `-peerbloomfilters`.

  Bloom filter have non existent privacy and server can omit filter's matches. However, both problems are completely irrelevant when you connect to your own node. If you connect to your own node, bloom filters are the most bandwidth efficient way to synchronize your light client without the need of some middleware like Electrum.

  It is also a superior alternative to BIP157 as it does not require to maintain an additional index and it would work well on pruned nodes.

  When I attempted to allow bloom filters for whitelisted peer, my proposal has been NACKed in favor of [a more flexible approach](https://github.com/bitcoin/bitcoin/pull/16176#issuecomment-500762907) which should allow node operator to set fine grained permissions instead of a global `whitelisted` attribute.

  Doing so will also make follow up idea very easy to implement in a backward compatible way.

  # Implementation details

  The PR propose a new format for `--white{list,bind}`. I added a way to specify permissions granted to inbound connection matching `white{list,bind}`.

  The following permissions exists:
  * ForceRelay
  * Relay
  * NoBan
  * BloomFilter
  * Mempool

  Example:
  * `-whitelist=bloomfilter@127.0.0.1/32`.
  * `-whitebind=bloomfilter,relay,noban@127.0.0.1:10020`.

  If no permissions are specified, `NoBan | Mempool` is assumed. (making this PR backward compatible)

  When we receive an inbound connection, we calculate the effective permissions for this peer by fetching the permissions granted from `whitelist`  and add to it the permissions granted from `whitebind`.

  To keep backward compatibility, if no permissions are specified in `white{list,bind}` (e.g. `--whitelist=127.0.0.1`) then parameters `-whitelistforcerelay` and `-whiterelay` will add the permissions `ForceRelay` and `Relay` to the inbound node.

  `-whitelistforcerelay` and `-whiterelay` are ignored if the permissions flags are explicitly set in `white{bind,list}`.

  # Follow up idea

  Based on this PR, other changes become quite easy to code in a trivially review-able, backward compatible way:

  * Changing `connect` at rpc and config file level to understand the permissions flags.
  * Changing the permissions of a peer at RPC level.

ACKs for top commit:
  laanwj:
    re-ACK c5b404e8f1973afe071a07c63ba1038eefe13f0f

Tree-SHA512: adfefb373d09e68cae401247c8fc64034e305694cdef104bdcdacb9f1704277bd53b18f52a2427a5cffdbc77bda410d221aed252bc2ece698ffbb9cf1b830577
2021-07-19 19:00:04 -05:00
MarcoFalke
9fd70ab11b Merge #14626: Select orphan transaction uniformly for eviction
7257353b93 Select orphan transaction uniformly for eviction (Pieter Wuille)

Pull request description:

  The previous code was biased towards evicting transactions whose txid has a larger gap (lexicographically) with the previous txid in the orphan pool.

Tree-SHA512: e35f700aea5ed79d1bc57f64bffcb623424b40156fd0a12f05f74f981a8aa4175d5c18d042989243f7559242bdf1d6d720bcf588d28f43d74a798a4843f09c70
Signed-off-by: pasta <pasta@dashboost.org>
2021-07-19 19:00:04 -05:00
Wladimir J. van der Laan
ff5a94748d
Merge #13249: Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations.
f34c8c466a0e514edac2e8683127b4176ad5d321 Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations. (practicalswift)

Pull request description:

  Make objects in range declarations immutable by default.

  Rationale:
  * Immutable objects are easier to reason about.
  * Prevents accidental or hard-to-notice change of value.

Tree-SHA512: cad69d35f0cf8a938b848e65dd537c621d96fe3369be306b65ef0cd1baf6cc0a9f28bc230e1e383d810c555a6743d08cb6b2b0bd51856d4611f537a12e5abb8b
2021-07-19 17:11:18 -05:00
Wladimir J. van der Laan
38ee2a7a94 Merge #14605: Return of the Banman
18185b57c32d0a43afeca4c125b9352c692923e9 scripted-diff: batch-recase BanMan variables (Carl Dong)
c2e04d37f3841d109c1fe60693f9622e2836cc29 banman: Add, use CBanEntry ctor that takes ban reason (Carl Dong)
1ffa4ce27d4ea6c1067d8984455df97994c7713e banman: reformulate nBanUtil calculation (Carl Dong)
daae598feb034f2f56e0b00ecfb4854d693d3641 banman: add thread annotations and mark members const where possible (Cory Fields)
84fc3fbd0304a7d6e660bf783c84bed2dd415141 scripted-diff: batch-rename BanMan members (Cory Fields)
af3503d903b1a608cd212e2d74b274103199078c net: move BanMan to its own files (Cory Fields)
d0469b2e9386a7a4b268cb9725347e7517acace6 banman: pass in default ban time as a parameter (Cory Fields)
2e56702ecedd83c4b7cb8de9de5c437c8c08e645 banman: pass the banfile path in (Cory Fields)
4c0d961eb0d7825a1e6f8389d7f5545114ee18c6 banman: create and split out banman (Cory Fields)
83c1ea2e5e66b8a83072e3d5ad6a4ced406eb1ba net: split up addresses/ban dumps in preparation for moving them (Cory Fields)
136bd7926c72659dd277a7b795ea17f72e523338 tests: remove member connman/peerLogic in TestingSetup (Cory Fields)
7cc2b9f6786f9bc33853220551eed33ca6b7b7b2 net: Break disconnecting out of Ban() (Cory Fields)

Pull request description:

  **Old English à la Beowulf**
  ```
  Banman wæs bréme    --blaéd wíde sprang--
  Connmanes eafera    Coreum in.
  aéglaéca            léodum forstandan
  Swá bealdode        bearn Connmanes
  guma gúðum cúð      gódum daédum·
  dréah æfter dóme·   nealles druncne slóg
  ```

  **Modern English Translation**
  ```
  Banman was famed              --his renown spread wide--
  Conman's hier,                in Core-land.
  against the evil creature     defend the people
  Thus he was bold,             the son of Connman
  man famed in war,             for good deeds;
  he led his life for glory,    never, having drunk, slew
  ```

  --

  With @theuni's blessing, here is Banman, rebased. Original PR: https://github.com/bitcoin/bitcoin/pull/11457

  --

  Followup PRs:
  1. Give `CNode` a `Disconnect` method ([source](https://github.com/bitcoin/bitcoin/pull/14605#discussion_r248065847))
  2. Add a comment to `std::atomic_bool fDisconnect` in `net.h` that setting this to true will cause the node to be disconnected the next time `DisconnectNodes()` runs ([source](https://github.com/bitcoin/bitcoin/pull/14605#discussion_r248384309))

Tree-SHA512: 9c207edbf577415c22c9811113e393322d936a843d4ff265186728152a67c057779ac4d4f27b895de9729f7a53e870f828b9ebc8bcdab757520c2aebe1e9be35
2021-07-17 22:32:12 -05:00
UdjinM6
886024ba25
Merge pull request #4203 from UdjinM6/pr4196
ci: Add `--enable-werror` to arm and c++17 builds (and fix all issues found via these builds)
2021-07-17 02:37:07 +03:00
Wladimir J. van der Laan
fdc99dcc64 Merge #19728: Increase the ip address relay branching factor for unreachable networks
86d4cf42d97abf4c436d1eabf29e2ed150f69c1e Increase the ip address relay branching factor for unreachable networks (Pieter Wuille)

Pull request description:

  Onion addresses propagate very badly among the IPv4/IPv6 network, resulting
  in difficulty for those to find each other.

  The branching factor 1 is probably so low that propagations die out before
  they reach another onion peer. Increase it to 1.5 on average.

ACKs for top commit:
  practicalswift:
    ACK 86d4cf42d97abf4c436d1eabf29e2ed150f69c1e -- patch looks correct
  naumenkogs:
    ACK 86d4cf4
  jonatack:
    ACK 86d4cf42d97abf4c436d1eabf29e2ed150f69c1e. Code review, built and running with some sanity check logging. `RelayAddress()` is called by `ProcessMessage() ADDR` msg handling, from within the loop while processing each new address to relay it to a limited number of other nodes. According to git blame, the line setting `nRelayNodes` hasn't been touched since 2016 in e736772c56 *Move network-msg-processing code out of main to its own file*, which moved the line but otherwise did not change it. Running a mixed clearnet/onion node with this patch and the logging below, I'm only seeing values of `fReachable 1, nRelayNodes 2`. IIUC, I need to use the settings in `init.cpp` that call `SetReachable(*, false)`. *Edit:* with `onlynet=onion` am now seeing entries of `fReachable 0` with `nRelayNodes` values of 1 and 2.
  vasild:
    ACK 86d4cf42d

Tree-SHA512: 22391e16d60bcfdec9a9336728da39d68a24a183b3d1b0e8fbc038d265ca6ddf71d16db018f3678745fd9f3e9281049e42197fa0a29124833c50a9170ed6f793
2021-07-15 19:30:07 -05:00
UdjinM6
d1ff298c8e
Add more compile time checking for cs_main runtime locking assertions 2021-07-13 19:43:33 +03:00
UdjinM6
cc601e80c5
Fix CConnman related locks 2021-07-13 19:43:32 +03:00
fanquake
e4060890f6 Merge #16188: net: Document what happens to getdata of unknown type
dddd9270f85bd2e71fd281a0c6b4053e02fce93c net: Document what happens to getdata of unknonw type (MarcoFalke)

Pull request description:

  Any getdata of unknown type will never be processed and blocks all future messages from a peer. This isn't obviously clear from reading the code, so document it.

Top commit has no ACKs.

Tree-SHA512: 4f8e43bbe6534242facfcfffae28b7a6aa2d228841fa2146a87d494e69f614b0da23cf7a5f3d4367358a7c1981fe2ec196a21c437ae1653f1c7e0351be22598a
2021-07-12 20:16:37 -05:00
Munkybooty
eae3b9abc4 Merge #13083: Add compile time checking for cs_main runtime locking assertions
9e0a514112 Add compile time checking for all cs_main runtime locking assertions (practicalswift)

Pull request description:

  Add compile time checking for `cs_main` runtime locking assertions.

  This PR is a subset of #12665. The PR was broken up to make reviewing easier.

  The intention is that literally all `EXCLUSIVE_LOCKS_REQUIRED`/`LOCKS_EXCLUDED`:s added in this PR should follow either directly or indirectly from `AssertLockHeld(…)`/`AssertLockNotHeld(…)`:s already existing in the repo.

  Consider the case where function `A(…)` contains `AssertLockHeld(cs_foo)` (without
  first locking `cs_foo` in `A`), and that `B(…)` calls `A(…)` (without first locking `cs_main`):
  * It _directly_ follows that: `A(…)` should have an `EXCLUSIVE_LOCKS_REQUIRED(cs_foo)` annotation.
  * It _indirectly_ follows that: `B(…)` should have an `EXCLUSIVE_LOCKS_REQUIRED(cs_foo)` annotation.

Tree-SHA512: 120e7410c4c223dbc7d42030b1a19e328d01a55f041bb6fb5eaac10ac35cb0c5d469b9b3bda6444731164c73b88ac6495a00890672b107d9305e891571f64dd6

# Conflicts:
#	src/validation.cpp
#	src/validation.h
#	src/wallet/feebumper.cpp
#	src/wallet/rpcwallet.cpp
#	src/wallet/wallet.h

# Conflicts:
#	src/wallet/wallet.h
2021-07-07 16:30:58 -04:00
Wladimir J. van der Laan
4cd32e43e4
Merge #13235: Break circular dependency: init -> * -> init by extracting shutdown.h
1fabd59e7 Break circular dependency: init -> * -> init by extracting shutdown.h (Ben Woosley)
e62fdfeea Drop unused init.h includes (Ben Woosley)

Pull request description:

  Most includers just wanted to react to pending shutdown.

  This isolates access to `fRequestShutdown` and limits access to the shutdown api functions, including the new `CancelShutdown` for setting it to `false`.

Tree-SHA512: df42f75dfbba163576710e9a67cf1228531fd99d70a2f187bfba0bcc476d6749cf88180a97e66a81bb5b6c3c7f0917de7402d26039ba7b644cb7509b02f7e267
2021-07-02 00:42:18 +03:00
Kittywhiskers Van Gogh
138997c8e6 partial bitcoin#15638: Add several util units 2021-06-27 12:03:15 +05:30
Kittywhiskers Van Gogh
ef4dfa8524 merge bitcoin#14555: Move util files to directory
(script modified to account for Dash backports, doesn't account for rebasing)

------------- BEGIN SCRIPT ---------------
mkdir -p src/util
git mv src/util.h src/util/system.h
git mv src/util.cpp src/util/system.cpp
git mv src/utilmemory.h src/util/memory.h
git mv src/utilmoneystr.h src/util/moneystr.h
git mv src/utilmoneystr.cpp src/util/moneystr.cpp
git mv src/utilstrencodings.h src/util/strencodings.h
git mv src/utilstrencodings.cpp src/util/strencodings.cpp
git mv src/utiltime.h src/util/time.h
git mv src/utiltime.cpp src/util/time.cpp
git mv src/utilasmap.h src/util/asmap.h
git mv src/utilasmap.cpp src/util/asmap.cpp
git mv src/utilstring.h src/util/string.h
git mv src/utilstring.cpp src/util/string.cpp

gsed -i 's/<util\.h>/<util\/system\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
gsed -i 's/<utilmemory\.h>/<util\/memory\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
gsed -i 's/<utilmoneystr\.h>/<util\/moneystr\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
gsed -i 's/<utilstrencodings\.h>/<util\/strencodings\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
gsed -i 's/<utiltime\.h>/<util\/time\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
gsed -i 's/<utilasmap\.h>/<util\/asmap\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
gsed -i 's/<utilstring\.h>/<util\/string\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')

gsed -i 's/BITCOIN_UTIL_H/BITCOIN_UTIL_SYSTEM_H/g' src/util/system.h
gsed -i 's/BITCOIN_UTILMEMORY_H/BITCOIN_UTIL_MEMORY_H/g' src/util/memory.h
gsed -i 's/BITCOIN_UTILMONEYSTR_H/BITCOIN_UTIL_MONEYSTR_H/g' src/util/moneystr.h
gsed -i 's/BITCOIN_UTILSTRENCODINGS_H/BITCOIN_UTIL_STRENCODINGS_H/g' src/util/strencodings.h
gsed -i 's/BITCOIN_UTILTIME_H/BITCOIN_UTIL_TIME_H/g' src/util/time.h
gsed -i 's/BITCOIN_UTILASMAP_H/BITCOIN_UTIL_ASMAP_H/g' src/util/asmap.h
gsed -i 's/BITCOIN_UTILSTRING_H/BITCOIN_UTIL_STRING_H/g' src/util/string.h

gsed -i 's/ util\.\(h\|cpp\)/ util\/system\.\1/g' src/Makefile.am
gsed -i 's/utilmemory\.\(h\|cpp\)/util\/memory\.\1/g' src/Makefile.am
gsed -i 's/utilmoneystr\.\(h\|cpp\)/util\/moneystr\.\1/g' src/Makefile.am
gsed -i 's/utilstrencodings\.\(h\|cpp\)/util\/strencodings\.\1/g' src/Makefile.am
gsed -i 's/utiltime\.\(h\|cpp\)/util\/time\.\1/g' src/Makefile.am
gsed -i 's/utilasmap\.\(h\|cpp\)/util\/asmap\.\1/g' src/Makefile.am
gsed -i 's/utilstring\.\(h\|cpp\)/util\/string\.\1/g' src/Makefile.am

gsed -i 's/-> util ->/-> util\/system ->/' test/lint/lint-circular-dependencies.sh
gsed -i 's/src\/util\.cpp/src\/util\/system\.cpp/g' test/lint/lint-format-strings.py test/lint/lint-locale-dependence.sh
gsed -i 's/src\/utilmoneystr\.cpp/src\/util\/moneystr\.cpp/g' test/lint/lint-locale-dependence.sh
gsed -i 's/src\/utilstrencodings\.\(h\|cpp\)/src\/util\/strencodings\.\1/g' test/lint/lint-locale-dependence.sh
------------- END   SCRIPT ---------------
2021-06-27 12:03:13 +05:30
UdjinM6
9e067f869d
Merge pull request #4213 from PastaPastaPasta/backport-p2p-pr1
backport: misc net backports
2021-06-27 02:56:23 +03:00
MarcoFalke
3a75bef4af
Merge #15654: net: Remove unused unsanitized user agent string CNode::strSubVer
fa8548c5d1 net: Remove unused unsanitized user agent string CNode::strSubVer (MarcoFalke)

Pull request description:

  I fail to see a use case for this unsanitized byte array. In fact this can easily be confused with `cleanSubVer` and be displayed to the user (or logged) by a simple typo that is hard to find in review.

  Further reading: https://btcinformation.org/en/developer-reference#version

ACKs for commit fa8548:
  promag:
    utACK fa8548c, good catch.
  practicalswift:
    utACK fa8548c5d13957f57f9b1e20e03002600962f7f0
  sipa:
    utACK fa8548c5d13957f57f9b1e20e03002600962f7f0

Tree-SHA512: 3c3ff1504d1583ad099df9a6aa761458a82ec48a58ef7aaa9b5679a5281dd1b59036ba2932ed708488951a565b669a3083ef70be5a58472ff8677b971162ae2f
2021-06-26 11:23:43 -05:00
Wladimir J. van der Laan
2a425933d7
Merge #15597: net: Generate log entry when blocks messages are received unexpectedly
ef0019e054734a14214dfbce56611ce4db1688a5 Generate log entry when blocks messages are received unexpectedly. (Patrick Strateman)

Pull request description:

  Currently these are incorrectly logged as an unknown command.

Tree-SHA512: dd272388a90b79897f8c1ea6d4c949323fcf75493f3a5b2ec9a26a2cf6a8ee743b497941702f21df8fae0f5b9481444363643379832dbd5053b0cc0b0363de04
2021-06-26 11:23:43 -05:00
MarcoFalke
2890306a95 Merge #14108: tests: Add missing locking annotations and locks (g_cs_orphans)
b602c9b3af tests: Add missing locking annotations and locks (practicalswift)

Pull request description:

  Add missing locking annotations and locks.

  `mapOrphanTransactions` is guarded by `g_cs_orphans`.

Tree-SHA512: f95104fbef23bd385e754c6bea3c3bdddd8a9c6a68e719d761227c9be1e46ff1316ec050a15a1243218dbab4e8584da6674f4a72f949f54b0a758392f19c83f8
2021-06-15 14:49:17 -04:00
UdjinM6
bcc8b35194
Merge pull request #4178 from UdjinM6/backports-0.17-pr30
Merge #13033: Build txindex in parallel with validation
2021-06-05 22:08:47 +03:00
Kittywhiskers Van Gogh
680067ce7a
merge #19954: Complete the BIP155 implementation and upgrade to TORv3 2021-05-29 23:24:52 +03:00
MarcoFalke
7475782bc0
Merge #13163: Make it clear which functions that are intended to be translation unit local
c3f34d06be Make it clear which functions that are intended to be translation unit local (practicalswift)

Pull request description:

  Make it clear which functions that are intended to be translation unit local.

  Do not share functions that are meant to be translation unit local with other translation units. Use internal linkage for those consistently.

Tree-SHA512: 05eebd233d5cfbf6116724eec3a99b465bf534ca220f2b6f5e56341a7da41387454d3cb6ceadd8ab6714a5df94069e4ad0dcab8801ccc7e8949be7199a19fb53
2021-05-25 14:09:36 +03:00
Pieter Wuille
7ff6515c88
Merge #13033: Build txindex in parallel with validation
9b2704777c [doc] Include txindex changes in the release notes. (Jim Posen)
ed77dd6b30 [test] Simple unit test for TxIndex. (Jim Posen)
6d772a3d44 [rpc] Public interfaces to GetTransaction block until synced. (Jim Posen)
a03f804f2a [index] Move disk IO logic from GetTransaction to TxIndex::FindTx. (Jim Posen)
e0a3b80033 [validation] Replace tx index code in validation code with TxIndex. (Jim Posen)
8181db88f6 [init] Initialize and start TxIndex in init code. (Jim Posen)
f90c3a62f5 [index] TxIndex method to wait until caught up. (Jim Posen)
70d510d93c [index] Allow TxIndex sync thread to be interrupted. (Jim Posen)
94b4f8bbb9 [index] TxIndex initial sync thread. (Jim Posen)
34d68bf3a3 [index] Create new TxIndex class. (Jim Posen)
c88bcec93f [db] Migration for txindex data to new, separate database. (Jim Posen)
0cb8303241 [db] Create separate database for txindex. (Jim Posen)

Pull request description:

  I'm re-opening #11857 as a new pull request because the last one stopped loading for people

  -------------------------------

  This refactors the tx index code to be in it's own class and get built concurrently with validation code. The main benefit is decoupling and moving the txindex into a separate DB. The primary motivation is to lay the groundwork for other indexers that might be desired (such as the [compact filters](https://github.com/bitcoin/bips/pull/636)). The basic idea is that the TxIndex spins up its own thread, which first syncs the txindex to the current block index, then once in sync the BlockConnected ValidationInterface hook writes new blocks.

  ### DB changes

  At the suggestion of some other developers, the txindex has been split out into a separate database. A data migration runs at startup on any nodes with a legacy txindex. Currently the migration blocks node initialization until complete.

  ### Open questions

  - Should the migration of txindex data from the old DB to the new DB block in init or should it happen in a background thread? The downside to backgrounding it is that `getrawtransaction` would return an error message saying the txindex is syncing while the migration is running.

  ### Impact

  In a sample size n=1 test where I synced nodes from scratch, the average time [Index writing](https://github.com/bitcoin/bitcoin/blob/master/src/validation.cpp#L1903) was 3.36ms in master and 1.72ms in this branch. The average time between `UpdateTip` log lines for sequential blocks between 400,000 and IBD end on mainnet was 0.297204s in master and 0.286134s in this branch. Most likely this is just variance in IBD times, but I can try with some more trials if people want.

Tree-SHA512: 451fd7d95df89dfafceaa723cdf0f7b137615b531cf5c5035cfb54e9ccc2026cec5ac85edbcf71b7f4e2f102e36e9202b8b3a667e1504a9e1a9976ab1f0079c4
2021-05-25 13:48:04 +03:00
PastaPastaPasta
b76e7fec1f
Merge pull request #4164 from kittywhiskers/auxprs
Merge #19660, #19373, #19841, #13862, #13866, #17280, #17682 and partial #19326, #14978: Auxiliary Backports
2021-05-21 14:25:27 -05:00
Kittywhiskers Van Gogh
bc2f11f230 Partial #19660: Make HexStr take a span
Comment from 6f7b52ac63a71d2706022ca58d69a1a622e0fa37: "The fix for CPubKey is a part of `#13557: BIP 174 PSBT Serializations and RPCs` which wasn't backported yet"
2021-05-20 10:15:17 +05:30
UdjinM6
a89202726f
instantsend: Remove islocks for rejected/removed txes (#4155)
* instantsend: Resolve block conflicts first and take care of mempool ones later

* refactor: Rename RemoveChainLockConflictingLock -> RemoveConflictingLock

* instantsend: Handle transaction removal from mempool (for all reasons besides inclusion in blocks)

* instantsend: Remove old islocks with no known txes from db (once)

* refactor: Replace magic number with CURRENT_VERSION

* fix: Do not remove islocks for (yet) valid orphans

* Apply suggestions from code review

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2021-05-14 19:17:16 -05:00
UdjinM6
182887acb9
instantsend: Push matching islocks when replying to merkleblock inv in getdata only when all txes are pushed (#4134) 2021-05-05 23:24:30 -04:00
UdjinM6
a8bef50052
Silence/tweak some log output (#4102)
* Silence some log output

* Drop redundant log output in ProcessGetData

* Tweak PushInventory log output
2021-04-17 15:23:54 -04:00
PastaPastaPasta
5074e6df9e
Extensive include refactoring (#4095)
* Simple changes, mostly just includes

* Continued include changes combined with using pointers to avoid including more than necessary in headers

* remove dup include

* masternode-utils.cpp include net.h in all builds

* resolve linter -7 +11

* drop quorums.h from dkgsessionhandler.cpp

* Add `<utilstrencodings.h>`

* Initialize lastMNListForVotingKeys

* Refactor GetMinedCommitment to return sharedptr

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-04-15 23:41:16 -04:00
PastaPastaPasta
a2e4eb0019
bunch of trivial typos / english fixes (#4101) 2021-04-15 14:19:03 -04:00
UdjinM6
0b7d7a084a
net: Use Intra-Quorum Relay connections for other messages too (#4021)
* net: Use Intra-Quorum Relay connections for other messages too

Make intra-quorum data delivery more robust.

* Apply review suggestions
2021-04-03 20:24:03 +03:00
dustinface
174f961d18
llmq: Refactor EnsureQuorumConnections (#4071)
* llmq: Return bool in EnsureQuorumConnections

* llmq: Call RemoveMasternodeQuorumNodes directly

Instead of removing the good nodes from the vector in first loop and 
call it with the bad ones in the second loop.

* refactor: Introduce and use CLLMQUtils::IsWatchQuorumsEnabled

* llmq: Move IsWatchQuorumsEnabled into EnsureQuorumConnections
2021-03-29 14:09:09 -04:00
PastaPastaPasta
f492291aca
refactor: llmq pretty trivial refactor circular dependancy (#4065)
* move DEFAULT_WATCH_QUORUMS to quorums.h

Signed-off-by: pasta <pasta@dashboost.org>

* resolve circular lint, -10, +4
2021-03-26 13:21:41 +01:00
UdjinM6
83663c564e
trivial|doc: Some trivial housekeeping (#4059)
* Fix extra line break in CommitTransaction log message

Introduced in #3680 ebe7e80a49 (diff-b2bb174788c7409b671c46ccc86034bdR4113)

* doc: Fix `quorum sign` help

* doc: Add `getdata` to quorum commands list help

* doc: Drop "P2WSH" from signrawtransactionwithkey help

* trivial: Replace "push_back(Pair(..))" with "pushKV"

* trivial: Reorder wallet cmd-line options

* git: Add macos debug simbols to .gitignore

* trivial: Fix typos and whitespaces, drop unused stuff
2021-03-26 13:11:11 +01:00
UdjinM6
bca9577b8f
partial/logic backport #18544: net: limit BIP37 filter lifespan (active between 'filterload'..'filterclear') (#4043)
* partial backport 18544: net: limit BIP37 filter lifespan (active between 'filterload'..'filterclear')

Previously, a default match-everything bloom filter was set for every peer,
i.e. even before receiving a 'filterload' message and after receiving a
'filterclear' message code branches checking for the existence of the filter
by testing the pointer "pfilter" were _always_ executed.

* net: Match the backport PR a bit more

Co-authored-by: xdustinface <xdustinfacex@gmail.com>
2021-03-22 13:29:31 +03:00
dustinface
ae506bae66
refactor: PrivateSend -> CoinJoin + Move the tab (#4038)
* qt|wallet|privatesend: Rename PrivateSend to CoinJoin in GUI strings

* qt: Move CoinJoin next to Transactions

* qt: Adjust status tip of privateSendCoinsMenuAction

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

* rename: privateSend -> coinJoin

* rename: privatesend -> coinjoin

* rename: PrivateSend -> CoinJoin

* rename: use_ps -> use_cj

* rename: PRIVATESEND -> COINJOIN

* rename: privatesend -> coinjoin for files and folders

* refactor: Re-order coinjoin files in cmake/make files

* refactor: Re-order coinjoin includes where it makes sense

* test: Update lint-circular-dependencies.sh

* Few cleanups

* test: test/coinjoin_tests.cpp -> wallet/test/coinjoin_test.cpp

* s/AdvancedPSUI/AdvancedCJUI/g

* s/privateSentAmountChanged/coinJoinAmountChanged/g

* wallet: Rename "ps_salt" backwards compatible

* Minimal PrivateSend -> CoinJoin migration for settings and cmd-line

* wallet: Fix privatesendrounds -> coinjoinrounds migration

* qt: Migrate nPrivateSendAmount -> nCoinJoinAmount

* `-coinjoindenoms` never existed

* Migrate all PS options/settings

* rpc: Formatting only

* qt: Make Send/CoinJoin tabs a bit more distinguishable

Co-authored-by: thephez <thephez@users.noreply.github.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-03-17 18:36:11 -04:00
UdjinM6
95e8492f31
llmq: Implement Intra-Quorum Relay connections for qrecsig-s (#4020)
* llmq: Implement Intra-Quorum Relay connections for qrecsig-s

Avoid relaying recsigs to non-masternodes.

* test: Simplify loop

* test: Assert connections are equal to llmq_size instead of static number

* test: Drop redundant brackets

* test: Fix typo

Co-authored-by: xdustinface <xdustinfacex@gmail.com>
2021-03-14 22:49:38 -04:00
UdjinM6
3c768739fc
chainlocks: Send an inv for the best ChainLock we have when replying to mempool p2p message (#3962) 2021-01-28 21:55:58 -05:00
dustinface
21cfb4c934
llmq|rpc|test|version: Implement P2P messages QGETDATA <-> QDATA (#3953)
* version: Bump PROTOCOL_VERSION and MIN_MASTERNODE_PROTO_VERSION

* version: Introduce LLMQ_DATA_MESSAGES_VERSION for QGETDATA/QDATA support

* test: Bump MY_VERSION to 70219 (LLMQ_DATA_MESSAGES_VERSION)

* llmq: Introduce CQuorumDataRequest as wrapper for QGETDATA requests

* llmq: Implement CQuorum::{SetVerificationVector, SetSecretKeyShare}

* llmq|net|protocol: Implement QGETDATA/QDATA P2P messages

* llmq: Restrict processing QGETDATA/QDATA to masternodes only

* llmq: Implement request limiting for QGETDATA/QDATA

* llmq: Implement CQuorumManger::RequestQuorumData

* rpc: Implement "quorum getdata" as wrapper around QGETDATA

Allows to trigger sending QGETDATA messages to connected peers by RPC.

* test: Handle QGETDATA/QDATA messages in mininode

* test: Add data structures to support QGETDATA/QDATA

* test: Add some helper in test_framework.py

* test: Implement tests for QGETDATA/QDATA in p2p_quorum_data.py

* test: Add p2p_quorum_data.py to BASE_SCRIPTS

* llmq|test: Add QWATCH support for QGETDATA/QDATA

* llmq: Store CQuorumPtr in cache, not CQuorumCPtr

* llmq: Fix cache usage after recent changes

* Use uacomment to create/find specific p2ps

* No need to use network adjusted time here, GetTime should be enough

* rpc: check proTxHash

* minor tweaks

* test: Adjustments after 4e27d6513e

* llmq: Rename and improve error lambda in CQuorumManager::ProcessMessage

* llmq: Process QDATA if -watchquorums is enabled

* test: Handle qwatch messages in mininode

* test: Add test for -watchquorums support

* test: Just some empty lines

* test: Properly stop the p2p network thread at the end of the test

* rpc: Adjust "quorum getdata" parameter descriptions

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>

* rpc: Fix optionality of proTxHash in "quorum getdata" command

* test: Test optionality of proTxHash for "quorum getdata" command

* test: Be more specific about imports in p2p_quorum_data.py

* llmq|rpc: Add some comments about the request.GetDataMask checks

* test: Some more empty lines

* rpc: One more parameter description

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>

* test: Unify assert statements / drop parentheses for all of them

* fix typo

Signed-off-by: pasta <pasta@dashboost.org>

* adjust some line wrapping to 80 chars

Signed-off-by: pasta <pasta@dashboost.org>

* tests: Seperate out into dif atomic methods, add logging

Signed-off-by: pasta <pasta@dashboost.org>

* test: Avoid restarting masternodes, just let available requests expire

Just takes a lot time and isn't required imo.

* test: Drop redundant code/tests after separation

This was introduced in 9e224ec2f2

* test: Merge three tests

"test_mnauth_restriction", "test_invalid_messages" and "test_invalid_unexpected_qdata" with the resulting name "test_basics" because i don't feel like DKG recovery thing should be part of a test called "test_invalid_messages" and giving it an own test probably wouldn't make a lot sense because it would still depend on "test_invalid_messages". I also think there is no need for a separated "test_invalid_unexpected_qdata".

* test: Rename test_ratelimiting_banscore -> test_request_limit

* test: Apply python style

* test: Wrap all at 120 characters

Thats the default "draw annoying warnings" setting for PyCharm (and IMO a reasonable line length).

* test: Move some variables

* test: Optimize for speed

* tests: use wait_until in get_mininode_id

* test: Don't use `!=` to check for `None`

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
Co-authored-by: pasta <pasta@dashboost.org>
2021-01-28 17:33:18 -05:00
UdjinM6
5d4431c017
refactor: Add (and use) queueAndMaybePushInv helper (#3961) 2021-01-25 22:35:18 -05:00
UdjinM6
f69d0f4d64
instantsend: Relay IS-locks for matching txes when replying to merkleblock inv in getdata (#3959) 2021-01-25 00:01:08 -05:00
UdjinM6
1f1f2d8078
refactor: Rename fMasternode and fMasternodeProbe (#3928)
* fMasternode -> m_masternode_connection

* fMasternodeProbe -> m_probe_connection

* probe_connection -> masternode_probe_connection
2021-01-14 13:59:18 -06:00
dustinface
885dcb1b66
refactor: Drop some unused code (#3919)
* llmq: Drop hash parameter in PreVerifyMessage methods

* llmq: Drop some unused variables

* rpc: Drop unused variable

* llmq|net: Drop some unused CConnman parameter

* llmq: Drop some unused quorum parameter

* llmq: Drop some unused nodeId parameter

* Drop unused variables

* llmq: Drop more

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-01-10 21:28:37 -06:00
PastaPastaPasta
1c6236dcbe
Merge pull request #3870 from PastaPastaPasta/backports-0.17-pr23
Backports 0.17 pr23
2020-12-15 19:05:58 -06:00
PastaPastaPasta
2937da2219
Refactor the hardening of DIP 1 (#3874)
* Refactor the hardening of DIP 1

Signed-off-by: pasta <pasta@dashboost.org>

* Update src/validation.cpp

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

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-12-15 15:54:51 -06:00
Wladimir J. van der Laan
0efc03deb0
Merge bitcoin#11041 Add LookupBlockIndex
Contains both the changes done upstream and changes done in Dash codebase

Signed-off-by: pasta <pasta@dashboost.org>
2020-12-15 11:20:19 -06:00
UdjinM6
b559a8f904
Backporting Statoshi and bitcoin#16728 (#2515)
* Backport Statoshi

This backports some of https://github.com/jlopp/statoshi.

Missing stuff: README.md and client name changes, segwit and fee estimation stats.

Fix RejectCodeToString

Fix copy-paste mistake s/InvalidBlockFound/InvalidChainFound/

* Merge #16728: move-only: move coins statistics utils out of RPC

8a3b2eb17572ca2131778d52cc25ec359470a90f move-only: move coins statistics utils out of RPC (James O'Beirne)

Pull request description:

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

  Parent PR: #15606
  Issue: #15605
  Specification: https://github.com/jamesob/assumeutxo-docs/tree/master/proposal

  ---

  In the short-term, this move-only commit will help with fuzzing (https://github.com/bitcoin/bitcoin/pull/15606#issuecomment-524482297). Later, these procedures will be used to compute statistics (particularly a content hash) for UTXO sets coming in from snapshots.

  Most easily reviewed with `git ... --color-moved=dimmed_zebra`. A nice follow-up would be adding unittests, which I'll do if nobody else gets around to it.

ACKs for top commit:
  MarcoFalke:
    ACK 8a3b2eb17572ca2131778d52cc25ec359470a90f, checked --color-moved=dimmed-zebra

Tree-SHA512: a187d2f7590ad2450b8e8fa3d038c80a04fc3d903618c24222d7e3172250ce51badea35860c86101f2ba266eb4354e6efb8d7d508b353f29276e4665a1efdf74

* Fix 16728

* Modernize StatsdClient

- Reuse some functionality from netbase
- Switch from GetRand to FastRandomContext
- Drop `using namespace std` and add `// namespace statsd`

* Introduce PeriodicStats and make StatsdClient configurable via -stats<smth> (enabled/host/port/ns/period)

* Move/rename tip stats from CheckBlock to ConnectBlock

* Add new false positives to lint-format-strings.py

* Add snprintf in statsd_client to the list of known violations in lint-locale-dependence.sh

* Fix incorrect include guard

* Use bracket syntax includes

* Replace magic numbers with defaults

* Move connection stats calculation into its own function

And bail out early if stats are disabled

* assert in PeriodicStats

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>

Co-authored-by: MarcoFalke <falke.marco@gmail.com>
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2020-12-15 10:22:23 -06:00
Wladimir J. van der Laan
82cb32f1d3
Merge #13020: Consistently log CValidationState on call failure
e4d0b44 Consistently log CValidationState on failure (Ben Woosley)

Pull request description:

  This replaces potential silent failures and partial logging with full logging. Seems providing at least minimal visibility to the failure is a good practice. E.g. `FlushStateToDisk` can return a rare but meaningful out of disk space error that would be better to note than leave out.

  Note many of these are related to `ActivateBestChain` or `FlushStateToDisk`. Only a few cases of ignored state remain, e.g. LoadExternalBlockFile and RelayWalletTransaction, where I expect logging would likely be spammy.

Tree-SHA512: fb0e521039e5a5250cd9c82e7a8676423b5e3899d495649c0e71752059d1984e5175f556386ade048f51a7d59f5c8e467df7fe91d746076f97d24c000ccf7891

13020 continued

Signed-off-by: pasta <pasta@dashboost.org>
2020-11-17 14:32:37 -05:00
UdjinM6
fb4f76c4a0
Call EraseObjectRequest as soon as an object is read from the stream (#3783)
EraseObjectRequest should nat be postponed for later (no reason to do so) or skipped due to early returns (this is a bug).
2020-10-28 22:02:05 +03:00
UdjinM6
b313e89476
Fix IS-locks sync via mempool p2p command (#3766) 2020-10-16 06:01:20 +03:00
PastaPastaPasta
df536f269a
Merge #13622: Remove mapRequest tracking that just effects Qt display. (#3694)
* Merge #13622: Remove mapRequest tracking that just effects Qt display.

beef7ec4be725beea870a2da510d2817487601ec Remove useless mapRequest tracking that just effects Qt display. (Matt Corallo)

Pull request description:

  I thought we had removed this a long time ago, TBH, its really
  confusing feedback to users that we display whether a tx was
  broadcast to immediate neighbor nodes, given that has little
  indication of whether the tx propagated very far.

Tree-SHA512: c9d0808fb60146919bb78d0860ec2193601966c944887eaae7837408422f7e85dfdb306407a613200cdd4726aec66da18df618ebc6a8cfe8650bf08d4a8dc155
Signed-off-by: pasta <pasta@dashboost.org>

# Conflicts:
#	src/interfaces/wallet.cpp
#	src/interfaces/wallet.h
#	src/net_processing.cpp
#	src/qt/guiconstants.h
#	src/qt/transactiondesc.cpp
#	src/qt/transactionrecord.cpp
#	src/qt/transactionrecord.h
#	src/qt/transactiontablemodel.cpp
#	src/validationinterface.cpp
#	src/validationinterface.h
#	src/wallet/wallet.cpp

* drop TX_STATUS_OFFLINE

Signed-off-by: pasta <pasta@dashboost.org>

Co-authored-by: Wladimir J. van der Laan <laanwj@gmail.com>
2020-09-12 17:33:54 +03:00
PastaPastaPasta
7725e6fa4b
p2p: remove some old protocol version checks/dead code (#3647)
Signed-off-by: pasta <pasta@dashboost.org>
2020-08-14 14:42:15 +03:00
UdjinM6
ffc38301f7 More of 13153 (fix LogPrintf-s) -- TODO: backport to 0.16 2020-07-29 10:56:26 -05:00
Wladimir J. van der Laan
2af1c8d6e7 Merge #13153: Add missing newlines to debug logging
4b75dcf devtools: Make linter check LogPrint calls (MarcoFalke)
ff2ad2d Add missing newlines to LogPrint debug logging (Wladimir J. van der Laan)

Pull request description:

  ~~Don't we have a linter that should catch these?~~

Tree-SHA512: 1a58eca01ded9c1719e943c09447deeb59bb06dba00528cf460eefe857fdf95b42671fbdebc87cdd2f51e931e86942d06587ffd097cbb0d8dd9eb7a0ba17a8f0
2020-07-29 10:55:33 -05:00
UdjinM6
a7e0957c82
Create one PS manager per wallet 2020-07-20 10:10:43 -05:00
UdjinM6
59bc2ca2b7
Split dsq processing out of mixing manager
Signed-off-by: pasta <pasta@dashboost.org>
2020-07-20 10:10:25 -05:00
UdjinM6
167e0f402c
Split mixing options out of mixing manager 2020-07-20 10:10:14 -05:00
Wladimir J. van der Laan
21d0711316
Merge #13615: net: Remove unused interrupt from SendMessages
4b6ab02122d225818f6c6a4b4ef343d2c90e6d55 Remove unused argument to ProcessGetBlockData(...) (practicalswift)
c469ecf22e8ab55acf2cf8fc6fcf34415b541f76 net: Remove unused interrupt from SendMessages (fanquake)

Pull request description:

  Discussed very briefly with cfields.

  Includes 65b4400 from #13554 as it's a similar refactor.

Tree-SHA512: 45cd64208a5c8164242db74e6687e9344ea592bab5e7f9ba8e1bb449057fc908ec9d8b8523748a68426e4a4304e3388a138cd834698b39837b2149b72beefdc9
2020-07-08 20:03:37 -05:00
MarcoFalke
f77b58e89f Merge #13312: docs: Add a note about the source code filename naming convention
e56771365b Do not use uppercase characters in source code filenames (practicalswift)
419a1983ca docs: Add a note about the source code filename naming convention (practicalswift)

Pull request description:

  Add a note about the source code filename naming convention.

Tree-SHA512: 8d329bd9e19bcd26e74b0862fb0bc2369b46095dbd3e69d34859908632763abd7c3d00ccc44ee059772ad4bae4460c2bcc1c0e22fd9d8876d57e5fcd346cea4b
2020-07-07 11:17:45 -05:00
pasta
9d26ad6d8f remove duplicate includes so that ./contrib/devtools/lint-includes.sh is clean
Signed-off-by: pasta <pasta@dashboost.org>
2020-07-01 20:12:03 -05:00
Alexander Block
c1f889c564
Dont skip sendmessages (#3534)
* Revert "Only call SendMessages when ProcessMessages did some work or when some time passed"

This reverts commit 24ead62905.

* Only skip SendMessages() for fMasternode connections
2020-06-18 21:51:24 +03:00
Alexander Block
737ed479bc
Don'd send SENDXXX messages to fMasternode connections (#3537)
And respect a received QSENDRECSIGS no matter if fMasternode or not. We
assume that fMasternode peers won't send QSENDRECSIGS from now on.
2020-06-18 11:41:18 +03:00
Wladimir J. van der Laan
8adade97a4 Merge #12603: [docs] PeerLogicValidation interface
b7cd08b71 Add documentation to PeerLogicValidation interface and related functions (James O'Beirne)

Pull request description:

  Adds docs for PeerLogicValidation's public interface and two related functions.

Tree-SHA512: b4c2f47e9baa9396d2b6faf3792e46b371c50cd91b9ac890f263f4d14eb24a71e7b40ceb4cbb41e254f5008eff357f417b842618e7ebece9039802ab2a5dd728
2020-06-17 14:29:55 -05:00
MarcoFalke
bb035972ee
Merge #12716: Fix typos and cleanup in various files
4d9b4256d8 Fix typos (Dimitris Apostolou)

Pull request description:

  Unfortunately I messed up my repo while trying to squash #12593 so I created a PR with just the correct fixes.

Tree-SHA512: 295d77b51bd2a9381f1802c263de7ffb2edd670d9647391e32f9a414705b3c8b483bb0e469a9b85ab6a70919ea13397fa8dfda2aea7a398b64b187f178fe6a06
Signed-off-by: pasta <pasta@dashboost.org>
2020-06-11 23:20:48 -05:00
UdjinM6
2b7657d9e4
Merge pull request #3518 from PastaPastaPasta/backports-0.17-pr1
Backports 0.17 pr1
2020-06-11 20:51:58 +03:00
MarcoFalke
26ca61ec21
Merge #10498: Use static_cast instead of C-style casts for non-fundamental types
9ad6746ccd Use static_cast instead of C-style casts for non-fundamental types (practicalswift)

Pull request description:

  A C-style cast is equivalent to try casting in the following order:

  1. `const_cast(...)`
  2. `static_cast(...)`
  3. `const_cast(static_cast(...))`
  4. `reinterpret_cast(...)`
  5. `const_cast(reinterpret_cast(...))`

  By using `static_cast<T>(...)` explicitly we avoid the possibility of an unintentional and dangerous `reinterpret_cast`. Furthermore `static_cast<T>(...)` allows for easier grepping of casts.

  For a more thorough discussion, see ["ES.49: If you must use a cast, use a named cast"](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#es49-if-you-must-use-a-cast-use-a-named-cast) in the C++ Core Guidelines (Stroustrup & Sutter).

Tree-SHA512: bd6349b7ea157da93a47b8cf238932af5dff84731374ccfd69b9f732fabdad1f9b1cdfca67497040f14eaa85346391404f4c0495e22c467f26ca883cd2de4d3c
2020-06-10 18:32:43 -05:00
MarcoFalke
490ef353c2 Merge #14027: Skip stale tip checking if outbound connections are off or if reindexing.
66b3fc5437 Skip stale tip checking if outbound connections are off or if reindexing. (Gregory Maxwell)

Pull request description:

  I got tired of the pointless stale tip notices in reindex and on nodes with connections disabled.

Tree-SHA512: eb07d9c5c787ae6dea02cdd1d67a48a36a30adc5ccc74d6f1c0c7364d404dc8848b35d2b8daf5283f7c8f36f1a3c463aacb190d70a22d1fe796a301bb1f03228
2020-06-08 20:27:14 -05:00
MarcoFalke
2fa446fde3 Merge #14025: p2p: Remove dead code for nVersion=10300
fa74d3d720 qa: Remove unused deserialization code in msg_version (MarcoFalke)
fa5099ceb7 p2p: Remove dead code for nVersion=10300 (MarcoFalke)

Pull request description:

  This code is undocumented and confusing as well as dead, since peers with a version that old are disconnected immediately.

Tree-SHA512: 58c131a2730b630ffdc191cd65fe736ed1bd57e184902e2af1b1399443c4654617e68774432016df023434055e85d2e8cd32fb03b40c508c3bb8db6d19427434
2020-06-08 20:27:14 -05:00
Wladimir J. van der Laan
63b12699b3 Merge #13907: Introduce a maximum size for locators.
e254ff5d53b79bee29203b965fca572f218bff54 Introduce a maximum size for locators. (Gregory Maxwell)

Pull request description:

  The largest sensible size for a locator is log in the number of blocks.
   But, as noted by Coinr8d on BCT a maximum size message could encode a
   hundred thousand locators.  If height were used to limit the messages
   that could open new attacks where peers on long low diff forks would
   get disconnected and end up stuck.

  Ideally, nodes first first learn to limit the size of locators they
   send before limiting what would be processed, but common implementations
   back off with an exponent of 2 and have an implicit limit of 2^32
   blocks, so they already cannot produce locators over some size.

  Locators are cheap to process so allowing a few more is harmless,
   so this sets the maximum to 64-- which is enough for blockchains
   with 2^64 blocks before the get overhead starts increasing.

Tree-SHA512: da28df9c46c988980da861046c62e6e7f93d0eaab3083d32e408d1062f45c00316d5e1754127e808c1feb424fa8e00e5a91aea2cc3b80326b71c148696f7cdb3
2020-06-08 20:27:14 -05:00
Wladimir J. van der Laan
19ac12e516 Merge #13423: [net] Thread safety annotations in net_processing
1e3bcd251768baeb95e555d51d2dc787a6b2acee [net_processing] Add thread safety annotations (Jesse Cohen)
f393a533bebc088985f94c725b9af881500ba998 Annotate AssertLockHeld() with ASSERT_CAPABILITY() for thread safety analysis (Jesse Cohen)

Pull request description:

  (note that this depends on #13417)
  This commit fully annotates all globals in net_processing with clang thread safety annotations. Subsequent commits will begin transitioning some of this data away from cs_main into locks that are local to net_processing. Static thread safety analysis should it easier to verify correctness of that process.

Tree-SHA512: b47aa410cb9ada21072370176aea9a74c575643fa1ee8cf1d43c8e28675eef17f33e5242ac422f840e8178e132ecb58412034c6334b68f1b57c686df80d4e8e2
2020-06-08 20:27:14 -05:00
Pasta
be08490c9d fix bip 61 in Dash Specific code, 13417 continued
Signed-off-by: Pasta <pasta@dashboost.org>
2020-06-08 20:27:14 -05:00
Pasta
eb33bd1b33 move Misbehaving declaration into the header since we use it outside of net_processing.cpp
Signed-off-by: Pasta <pasta@dashboost.org>
2020-06-08 20:27:14 -05:00
Pasta
67c0459caf Adjust STALE_CHECK_INTERVAL to be correct for Dash
Signed-off-by: Pasta <pasta@dashboost.org>
2020-06-08 20:27:14 -05:00
Pieter Wuille
5b72c199ff Merge #13417: [net] Tighten scope in net_processing
3339ba28e9 Make g_enable_bip61 a member variable of PeerLogicValidation (Jesse Cohen)
6690a28606 Restrict as much as possible in net_processing to translation unit (Jesse Cohen)
1d4df02b7e [move-only] Move things only referenced in net_processing out of header file (Jesse Cohen)
02bbc05310 Rescope g_enable_bip61 to net_processing (Jesse Cohen)

Pull request description:

  As part of a larger effort to decouple net_processing and validation a bit, these are a bunch of simple scope cleanups. I've moved things out of the header file that are only referenced in net_processing and added static (or anonymous namespace) modifiers to everything possible in net_processing.

  There are a handful of functions which could be static except that they are exposed for the sake of unit testing - these are explicitly commented. There has been some discussion of a compile time annotation, but no conclusion has been reached on that yet.

  This is somewhat related to other prs #12934 #13413 #13407 and will be followed by prs that reduce reliance on cs_main to synchronize data structures which are translation unit local to net_processing

Tree-SHA512: 46c9660ee4e06653feb42ba92189565b0aea17aac2375c20747c0d091054c63829cbf66d2daddf65682b58ce1d6922e23aefea051a7f2c8abbb6db253a609082
Signed-off-by: Pasta <pasta@dashboost.org>

# Conflicts:
#	src/init.cpp
#	src/net_processing.cpp
#	src/net_processing.h
#	src/test/test_dash.cpp
2020-06-08 20:27:14 -05:00
Jonas Schnelli
aaf5bf1a7e Merge #12878: [refactor] Config handling refactoring in preparation for network-specific sections
77a733a99 [tests] Add additional unit tests for -nofoo edge cases (Anthony Towns)
af173c2be [tests] Check GetChainName works with config entries (Anthony Towns)
fa27f1c23 [tests] Add unit tests for ReadConfigStream (Anthony Towns)
087c5d204 ReadConfigStream: assume the stream is good (Anthony Towns)
6d5815aad Separate out ReadConfigStream from ReadConfigFile (Anthony Towns)
834d30341 [tests] Add unit tests for GetChainName (Anthony Towns)
11b6b5b86 Move ChainNameFromCommandLine into ArgsManager and rename to GetChainName (Anthony Towns)

Pull request description:

  This does a bit of refactoring of the configuration handling code in order to add additional tests to make adding support for [test]/[regtest] sections in the config file in #11862 easier. Should not cause any behaviour changes.

Tree-SHA512: 8d2ce1449fc180de03414e7e569d1a21ba1e9f6564e13d3faf3961f710adc725fa0d4ab49b89ebd2baa11ea36ac5018377f693a84037d386a8b8697c9d6db3e9
2020-05-09 17:35:59 -05:00
UdjinM6
b0963b079e
Fix deadlocks (#3456)
* Lock mempool before locking cs_wallet

This fixes deadlocks introduced in 78d303c3fd6fe8103f2cec95a2eff0f6a880a46e/#3361

* Fix mempool.cs vs cs_inventory potential deadlock

POTENTIAL DEADLOCK DETECTED
Previous lock order was:
 pnode->cs_sendProcessing  net.cpp:2724
 cs_main  net_processing.cpp:3867 (TRY)
 (1) pto->cs_inventory  net_processing.cpp:4106
 (2) cs  txmempool.cpp:1137
Current lock order is:
 cs_main  wallet/rpcwallet.cpp:468
 (2) mempool.cs  wallet/rpcwallet.cpp:468
 pwallet->cs_wallet  wallet/rpcwallet.cpp:469
 cs_main  wallet/wallet.cpp:4045
 (2) mempool.cs  wallet/wallet.cpp:4045
 cs_wallet  wallet/wallet.cpp:4046
 cs_vNodes  net.cpp:3464
 (1) cs_inventory  ./net.h:1056
2020-05-02 18:49:49 +03:00
PastaPastaPasta
087d98477b
Merge bitcoin#10387: Eventually connect to NODE_NETWORK_LIMITED peers (#3417)
* Merge #10387: Eventually connect to NODE_NETWORK_LIMITED peers

eb91835 Add setter for g_initial_block_download_completed (Jonas Schnelli)
3f56df5 [QA] add NODE_NETWORK_LIMITED address relay and sync test (Jonas Schnelli)
158e1a6 [QA] fix mininode CAddress ser/deser (Jonas Schnelli)
fa999af [QA] Allow addrman loopback tests (add debug option -addrmantest) (Jonas Schnelli)
6fe57bd Connect to peers signaling NODE_NETWORK_LIMITED when out-of-IBD (Jonas Schnelli)
31c45a9 Accept addresses with NODE_NETWORK_LIMITED flag (Jonas Schnelli)

Pull request description:

  Eventually connect to peers signalling NODE_NETWORK_LIMITED if we are out of IBD.
  Accept and relay NODE_NETWORK_LIMITED peers in addrman.

Tree-SHA512: 8a238fc97f767f81cae1866d6cc061390f23a72af4a711d2f7158c77f876017986abb371d213d1c84019eef7be4ca951e8e6f83fda36769c4e1a1d763f787037
Signed-off-by: Pasta <pasta@dashboost.org>

# Conflicts:
#	src/init.cpp
#	src/protocol.h
#	test/functional/node_network_limited.py

* remove witness

Signed-off-by: Pasta <pasta@dashboost.org>

* fix test expecting witness flag

Signed-off-by: Pasta <pasta@dashboost.org>

Co-authored-by: Wladimir J. van der Laan <laanwj@gmail.com>
2020-04-19 16:21:47 +03:00
PastaPastaPasta
d804a753af
Merge bitcoin#13134: net: Add option -enablebip61 to configure sending of BIP61 notifications (#3414)
* Merge #13134: net: Add option `-enablebip61` to configure sending of BIP61 notifications

87fe292d897e09e176ac7e254144466c319cc9ac doc: Mention disabling BIP61 in bips.md (Wladimir J. van der Laan)
fe16dd8226d924f44432c5b5014aa49ff45c82ff net: Add option `-enablebip61` to configure sending of BIP61 notifications (Wladimir J. van der Laan)

Pull request description:

  This commit adds a boolean option `-peersendreject`, defaulting to `1`, that can be used to disable the sending of [BIP61](https://github.com/bitcoin/bips/blob/master/bip-0061.mediawiki) `reject` messages. This functionality has been requested for various reasons:

  - security (DoS): reject messages can reveal internal state that can be used to target certain resources such as the mempool more easily.

  - bandwidth: a typical node sends lots of reject messages; this counts against upstream bandwidth. Also the reject messages tend to be larger than the message that was rejected.

  On the other hand, reject messages can be useful while developing client software (I found them indispensable while creating bitcoin-submittx), as well as for our own test cases, so whatever the default becomes on the long run, IMO the functionality should be retained as option. But that's a discussion for later, for now it's simply a node operator decision.

  Also adds a RPC test that checks the functionality.

Tree-SHA512: 9488cc53e13cd8e5c6f8eb472a44309572673405c1d1438c3488f627fae622c95e2198bde5ed7d29e56b948e2918bf1920239e9f865889f4c37c097c37a4d7a9

* 0.17 -> 0.16

Signed-off-by: Pasta <pasta@dashboost.org>

* tx1 -> base_ tx fixing 13134

Signed-off-by: Pasta <pasta@dashboost.org>

* move added bip61 message checking up

Signed-off-by: Pasta <pasta@dashboost.org>

* Dash specific code, only send reject messages if bip61 is enabled

Signed-off-by: Pasta <pasta@dashboost.org>

* Fix invalidtxrequest.py

Co-authored-by: Wladimir J. van der Laan <laanwj@gmail.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-04-19 14:04:31 +03:00
PastaPastaPasta
3d175aa2e5
Merge bitcoin#13151: net: Serve blocks directly from disk when possible (#3408)
* Merge #13151: net: Serve blocks directly from disk when possible

0bf431870e45d8e20c4671e51a782ebf97b75fac net: Serve blocks directly from disk when possible (Wladimir J. van der Laan)

Pull request description:

  In `ProcessGetBlockData`, send the block data directly from disk if type MSG_WITNESS_BLOCK is requested. This is a valid shortcut as the on-disk format matches the network format.

  This is expected to increase performance because a deserialization and subsequent serialization roundtrip is avoided.

Tree-SHA512: 9a9500b4c1354eaae1a6f1c6ef2416c1c1985029852589266f3a70e808f6c7482c135e9ab251a527566935378ab7c32dba4ed43ba5451e802d8e72b77d1ba472
Signed-off-by: Pasta <pasta@dashboost.org>

# Conflicts:
#	src/net_processing.cpp
#	src/validation.cpp

* fix extra bracket

Signed-off-by: Pasta <pasta@dashboost.org>

* remove read raw block from disk functions

Signed-off-by: Pasta <pasta@dashboost.org>

* correct `if (pblock)` scope

Signed-off-by: Pasta <pasta@dashboost.org>

Co-authored-by: Wladimir J. van der Laan <laanwj@gmail.com>
2020-04-19 14:03:27 +03:00
Alexander Block
96ed9fae39
Merge pull request #3429 from codablock/pr_remove_optimistic_send
Fix flushing of rejects before disconnecting
2020-04-17 21:46:36 +02:00
Alexander Block
d8bbdee7c4 Remove support for optimistic send
This was only used in only one remaining place and only to ensure that
reject messages are sent before closing sockets. This is solved by the
previous commit now.
2020-04-17 11:32:18 +02:00
Alexander Block
6ca78b601e Introduce NETCONN logging category and NET_NETCONN to log in NET and NETCONN
This allows easier debugging of connection issues, as it produces much less
chatter in the logs when only -debug=mnconn is given.
2020-04-17 08:52:57 +02:00
Alexander Block
9e57c35e82 Don't even try to send/receive blocks for fMasternode connections
This avoids a lot of overhead in SendMessages, which is called very often.
2020-04-16 18:06:59 +02:00
Alexander Block
a808ff3330 Temporary hack for unnecessary invocations of Broadcast signal 2020-04-16 18:06:59 +02:00
Alexander Block
24ead62905 Only call SendMessages when ProcessMessages did some work or when some time passed
Invoking SendMessages for hundreds of peers while we know that there is no
work to do give a lot of overhead on the message handler thread.
2020-04-16 18:06:59 +02:00
Alexander Block
d80212c47c Fix use of mocktime when calling PoissonNextSendInbound
This seems to have been wrong already in the backported PR.
2020-04-14 15:16:51 +02:00
MarcoFalke
c52c1e1ce5 Merge #17243: p2p: add PoissonNextSend method that returns mockable time
1a8f0d5a74d5cc0000456932babf35301f5c1686 [tools] update nNextInvSend to use mockable time (Amiti Uttarwar)
4de630354fc6808b9b13b9e82da1a82f2f50f26a [tools] add PoissonNextSend method that returns mockable time (Amiti Uttarwar)

Pull request description:

  Introduce a Poisson helper method that wraps the existing method to return `std::chrono::duration` type, which is mockable.

  Needed for https://github.com/bitcoin/bitcoin/pull/16698.

ACKs for top commit:
  ajtowns:
    ACK 1a8f0d5a74d5cc0000456932babf35301f5c1686
  MarcoFalke:
    re-ACK 1a8f0d5a74d5cc0000456932babf35301f5c1686
  naumenkogs:
    ACK 1a8f0d5, and let's merge it and come back to it later.

Tree-SHA512: 7e2325d7c55fc0b4357cb86b83e0c218ba269f678c1786342d8bc380bfd9696373bc24ff124b9ff17a6e761c62b2b44ff5247c3911e2afdc7cc5c20417e8290b
2020-04-14 13:32:50 +02:00
Pieter Wuille
ea9f97c53b Merge #13298: Net: Bucketing INV delays (1 bucket) for incoming connections to hide tx time
d45b344ffd Bucket for inbound when scheduling invs to hide tx time (Gleb)

Pull request description:

  It has been brought up to my attention that current random delays mechanism (originally intended to obfuscate transaction metadata) allows to easily estimate the time a transaction was received by a node.

  It may be done by connecting multiple observer nodes to the same node. Each of those nodes will generate its own schedule of delays. Combined metadata regarding those events from different sources allows an observer to estimate transaction time.

  After this patch a spy won't gain additional information by just creating multiple connections to a target.

Tree-SHA512: c71dae5ff350b614cb40a8e201fd0562d3e03e3e72a5099718cd451f0d84c66d5e52bbaf0d5b4b75137514c8efdedcc6ef4df90142b360153f04ad0721545ab1
2020-04-14 13:32:50 +02:00
Alexander Block
8a0f702f39 Use verifiedProRegTxHash.IsNull() instead of fMasternode to check for MN connections
fMasternode connections don't even relay anything anymore.
2020-04-14 13:32:50 +02:00
UdjinM6
d2756fb210
Merge pull request #3395 from PastaPastaPasta/backports-0.16-pr16
Backports 0.16 pr16
2020-04-10 13:11:03 +03:00
Alexander Block
26dec64e79
Merge pull request #3397 from codablock/pr_backport_txrequests
Backport bitcoin#14897 and bitcoin#15834 and modify it to work with Dash messages
2020-04-09 00:12:44 +02:00
Luke Dashjr
38ccf6f628
Bugfix: Include <memory> for std::unique_ptr 2020-04-08 11:46:27 -05:00
UdjinM6
775e4ba823 transactions -> objects
+ corresponding changes in comments
2020-04-08 14:51:42 +02:00
Alexander Block
a7b38efb98 Fix GetObjectInterval and EraseObjectRequest 2020-04-08 14:51:20 +02:00
Alexander Block
8e5fbedf21 net: Use mockable time for tx download
# Conflicts:
#	src/net_processing.cpp
#	src/random.cpp
#	src/random.h
2020-04-08 14:51:14 +02:00
Alexander Block
2d4cc8a19e More logging for object request handling 2020-04-07 13:26:47 +02:00
Alexander Block
81503598b9 No inbound delay for non-TX objects and masternodes 2020-04-07 13:26:34 +02:00
Alexander Block
26fcd3f0bf Also remove m_tx_announced and m_tx_in_flight entries when EraseObjectRequest is called
Otherwise they'll run into false-positive timeouts.
2020-04-07 13:25:29 +02:00