Commit Graph
459 Commits
Author SHA1 Message Date
selsta 7835582391 protocol: reduce log level for one-block sync candidates 2026-08-20 19:01:10 +02:00
j-berman 236ca60be0 cryptonote_basic: parse_and_validate_tx param to check max size
Simple API to check max blob size before parsing. This is useful
when reading blobs from untrusted sources.

@selsta pointed out that coinbase txs can technically be larger
than get_max_tx_size(), otherwise we could enforce it on all txs.
2026-08-13 09:12:10 -07:00
tobtoht 6ce9d445f8 Merge pull request #10303
700ec36 Prevent inaccurate missing spans when adding a block (j-berman)

ACKs: navidR*, selsta, thomasbuilds, jpk68
2026-08-12 10:07:46 +00:00
tobtoht fcd62c20d7 Merge pull request #11057
fccaccb src: fix issues found through static analysis (jpk68)

ACKs: jeffro256, SNeedlewoods
2026-08-11 21:21:49 +00:00
tobtoht d8c8cc310c Merge pull request #11048
a47a436 p2p: update peer's height on new block & widen window for relay (j-berman)

ACKs: selsta, Boog900
2026-08-10 15:47:20 +00:00
j-berman a47a43651c p2p: update peer's height on new block & widen window for relay
- We select peers to relay to based on their latest known sync height.
- This change:
A) makes sure to update the peer's latest known sync height upon
validating the peer's newly relayed blocks.
B) Allows for a wider window so that if we haven't yet received the
peer's block or finished validating it, then the peer can still be
a valid candidate to receive our new txs.
2026-08-06 09:16:28 -07:00
jpk68 fccaccbc8e src: fix issues found through static analysis 2026-08-05 21:45:36 -04:00
jpk68 e6d0d1e722 cryptonote_protocol: avoid copying block span in add_blocks 2026-08-02 12:54:37 -04:00
tobtoht 42f566231a Merge pull request #10980
1bae55a p2p: stop buffered dispatch after fatal notifications (selsta)

ACKs: jpk68*, SChernykh
2026-08-01 15:20:17 +00:00
selsta 1bae55aef1 p2p: stop buffered dispatch after fatal notifications 2026-07-27 19:33:24 +02:00
tobtoht 68e3b19661 Merge pull request #10933
c2dc8a5 cryptonote_protocol: remove dead code (Thomas)

ACKs: selsta, jpk68
2026-07-26 20:34:41 +00:00
Thomas c2dc8a5bc6 cryptonote_protocol: remove dead code
block_queue:
- print(): added with two debug call sites in the sync-speedup rewrite
  (5be43fcdb, 2017-07-02); 08abb670e (2017-08-12) removed one call and
  Pruning (b750fb27b, 2018-04-29) removed the last; dead since.
- get_num_filled_spans_prefix(): added in 5be43fcdb (2017-07-02)
  without any caller; dead on arrival.
- get_last_known_hash(): added in 5be43fcdb with one caller in the
  protocol handler; 08abb670e (2017-08-12) removed that caller while
  reworking reorg handling; dead since.
- has_spans(): added in 7b7476075 (2017-08-16, kick idle synchronizing
  peers) without any caller; dead on arrival.
- get_download_rate(): added by Pruning (b750fb27b, 2018-04-29)
  without any caller; dead on arrival.
- has_unpruned_height(): declaration added by Pruning (b750fb27b); a
  definition never existed, so it was never callable.

cryptonote_protocol_handler:
- get_synchronizing_connections_count(): from the original 2014 import
  (296ae46ed, 2014-03-03); its only reference was already commented
  out in the import, and 8efa1313f (2014-03-20) deleted that comment.
  Never had a live caller in the repo's history.
- PASSIVE_PEER_KICK_TIME: added in 1ff638e92 (2017-10-19) with one use
  in the idle-peer kick threshold; Pruning (b750fb27b) removed the
  use, orphaning the macro.
- LOCALHOST_INT: added in ae2a50659 (2015-02-20) for numeric localhost
  comparisons, second use added in c511abf00; 072102cfd (2017-05-27,
  abstracted network addresses) removed both uses.
2026-07-20 12:59:04 +02:00
jeffro256 edea8505db general: replace auto_scope_leave_caller with scope_guard
And replace unused inclusions of misc_language.h
2026-07-15 19:54:58 -05:00
tobtoht 381fce8dde Merge pull request #10828
fecef76 Fix spelling typos in comments and string literals (Thomas)

ACKs: tobtoht, selsta
2026-07-02 13:18:56 +00:00
j-berman 700ec36e75 Prevent inaccurate missing spans when adding a block 2026-06-30 10:14:43 -07:00
tobtoht d6a90937c8 Merge pull request #10835
330062a Optimized handle_notify_new_transactions's duplicate tx check - Check sha256 digests instead of full blobs (much less memory used) - Replace `find->insert` sequence with a single `insert` - 2x fewer hashset accesses - Preallocate the required size for the hashset (no full-table rehashes) (SChernykh)

ACKs: selsta, j-berman
2026-06-30 09:59:55 +00:00
tobtoht 6f09e39866 Merge pull request #10597
d8f3b81 p2p: restore safe sync mode when target height drops (selsta)

ACKs: SChernykh, j-berman
2026-06-30 09:54:19 +00:00
SChernykh 330062a004 Optimized handle_notify_new_transactions's duplicate tx check
- Check sha256 digests instead of full blobs (much less memory used)
- Replace `find->insert` sequence with a single `insert` - 2x fewer hashset accesses
- Preallocate the required size for the hashset (no full-table rehashes)
2026-06-29 08:06:31 +02:00
Thomas fecef767c9 Fix spelling typos in comments and string literals 2026-06-27 09:53:48 +02:00
selsta d8f3b81f79 p2p: restore safe sync mode when target height drops 2026-06-24 21:58:51 +02:00
Thomas 02db831d01 Fix spelling typos 2026-06-18 09:30:42 +02:00
SChernykh 196078ea0c Refactored tx verification NIC logic
Encapsulated `nic_verified_hf_version` and `txs_by_txid` to make it impossible for callers to skip updating it.
2026-06-04 09:55:38 +02:00
tobtoht 272a8d71fe Merge pull request #10600
6fc7aa8 cryptonote_protocol: fix peer overview logging (selsta)
2026-05-20 15:50:24 +00:00
tobtoht 892a136faf Merge pull request #10599
f4795a0 Remove obsolete test-drop-download debug options (selsta)
2026-05-20 15:49:47 +00:00
selsta 6fc7aa8398 cryptonote_protocol: fix peer overview logging 2026-05-14 18:09:48 +02:00
selsta f4795a0001 Remove obsolete test-drop-download debug options
These options were introduced in 2015 as manual debug helpers for
network-limit testing. They are not used by the current test suite.
2026-05-14 17:56:54 +02:00
Thomas 2c327aa325 fix spelling in comments and docs 2026-05-13 21:20:05 +02:00
tobtoht fb5b06bd3b Merge pull request #10520
a5ab8e5 net: replace deprecated boost::asio::strand::wrap with bind_executor (ryurt46)
2026-05-13 11:08:59 +00:00
tobtoht 49ea802139 Merge pull request #9899
05ab316 epee: better scope leaver (jeffro256)
2026-05-06 19:34:39 +00:00
jeffro256 05ab316853 epee: better scope leaver
1. Doesn't allocate a `boost::shared_ptr`
2. Doesn't use a vtable
3. Doesn't use `std::function` wrapper
4. Doesn't necessarily copy functional object
5. Doesn't need a factory function for simple declaration (yay CTAD)
6. Isolated to its own header
7. Name doesn't suck as much
2026-05-06 11:59:00 -05:00
ryurt46 a5ab8e5709 net: replace deprecated boost::asio::strand::wrap with bind_executor 2026-05-04 19:10:06 +02:00
selsta 13b42258b2 p2p: check p2p state before parsing in handle_notify_new_transactions 2026-04-28 18:21:51 +02:00
tobtoht d4732d6fdb Merge pull request #10440
b4ba1ec cryptonote_protocol: cleanup_handle_incoming_blocks on scope exit (j-berman)
2026-04-22 18:07:38 +00:00
tobtoht 519b26375c Merge pull request #10438
94089a8 cryptonote_basic: pruned hash return bool (j-berman)
2026-04-22 18:05:34 +00:00
j-berman b4ba1ec69c cryptonote_protocol: cleanup_handle_incoming_blocks on scope exit 2026-04-21 12:07:59 -07:00
j-berman 94089a8788 cryptonote_basic: pruned hash return bool 2026-04-21 12:04:31 -07:00
j-berman 0150d45e39 connection: try-catch handles 2026-04-21 12:00:56 -07:00
tobtoht 50da8bf8a5 Merge pull request #10186
0673c95 tx_memory_pool: speedup get_complement() for large requests (jeffro256)
2026-03-28 19:45:05 +00:00
tobtoht 55abb977b2 Merge pull request #10312
c93c4fc Misc clang 21 fixes (jeffro256)
2026-02-18 22:18:09 +00:00
jeffro256 c93c4fc829 Misc clang 21 fixes
* Use -O3 and other flags instead of -Ofast
  - https://discourse.llvm.org/t/rfc-deprecate-ofast/78687
  - https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
* Find libunwind library based on C++ compiler type, not C compiler type
* In stack_trace.cpp, pass stream modifiers to `std::stringstream` first, then send string to log
* In stack_trace.cpp, remove dead code related to `stack_trace_log` path
* Remove `virtual` method attributues from `final` class `cryptonote::core`
* Remove unused `this` capture in cryptonote protocol handler
* Remove unused variable `bad` in net node
* Use `std::make_unsigned` instead of `boost::make_unsigned`
  - https://github.com/boostorg/type_traits/issues/171
  - https://github.com/boostorg/type_traits/issues/202
  - https://github.com/boostorg/type_traits/pull/199
* Cleanup `include`s in pair serialization
* Test convergence b/t `std::make_unsigned` and `boost::make_unsigned`

Fixes compilation and silences warnings on:
clang version 21.1.6
Linux 6.18.8-3-cachyos
2026-02-09 09:42:32 -07:00
Navid Rahimiandnahuhh 508b6ee8fb src: dynamic span, to calculate span limit dynamically
Co-authored-by: nahuhh
    - jberman review
    - cryptonote_protocol: don't arbitrarily download 1000 blocks ahead
    - further restrict `proceed` to require `queue_proceed` in all cases.
      ensure queue_proceed is true if we need the next block, even if we
      already exceed the span and size limits

cryptonote_protocol: improved logging + const usage in span downloader
2026-02-04 08:54:23 +00:00
tobtoht 20ef991839 Merge pull request #9494
2a1a489 src: dynamic block sync size Co-authored-by: nahuhh (0xFFFC0000)
2026-02-03 21:25:04 +00:00
j-berman d7c5f95704 p2p: fix race causing dropped connections during sync
Without this commit:
1) read height from DB
2) add block to chain in separate thread
3) read chain for block id's and request them from peer
4) ERR in handle_response_chain_entry, peer's first block is the
one that was added to the chain, which has block idx=height from
step 1.

This commit reads the chain for height and highest block id's
in one go while holding the m_blockchain_lock to avoid the race.
2025-12-11 21:36:42 -08:00
jeffro256 0673c957af tx_memory_pool: speedup get_complement() for large requests
Changes complexity from M*N to (2*N+M)*log2(M). The FCMP++ stressnet recently hit mempool sizes of ~55k txs.
If the requesting node's mempool is populated, this results in an average of (55000*55000)/2
(about 1.5 billion) comparisons for the responding node. Under this commit, this would be reduced to
(55000+55000)*log2(55000) comparisons (about 2.6 million), a 99.83% reduction.
2025-11-26 13:40:33 -06:00
tobtoht cdaca019fc Merge pull request #10201
52b4c73 cryptonote_protocol: accurate next_needed_height when there is an overlap (0xFFFC0000)
2025-11-11 22:41:41 +00:00
j-berman c01e1fa288 Fix logging deadlock 2025-11-11 10:43:39 -08:00
0xFFFC0000 52b4c73ab4 cryptonote_protocol: accurate next_needed_height when there is an overlap 2025-11-11 00:29:23 +03:30
tobtoht c7046302d4 cmake: don't redefine project 2025-06-24 08:01:37 +02:00
0xFFFC0000andnahuhh 2a1a4897cb src: dynamic block sync size
Co-authored-by: nahuhh
2025-05-13 13:51:42 +00:00
0xFFFC0000 d106e21b74 src: fix clangd warnings 2025-05-01 05:27:35 +00:00