merge-script
278b9e39df
Merge bitcoin/bitcoin#34934: fuzz: exercise ForNode/ForEachNode callbacks in connman fuzz harness
371eac8069 fuzz: exercise ForNode/ForEachNode callbacks in connman fuzz harness (frankomosh)
Pull request description:
Track inserted node IDs and sometimes reuse them in `ForNode()` so the successful lookup path is exercised more reliably. Replace no-op callbacks with lightweight CNode accessor calls to make `ForEachNode()` and `ForNode()` cover previously unreached callback code paths.
This addresses feedback from https://github.com/bitcoin/bitcoin/pull/34830#issuecomment-4074732710 where it was noted that the callbacks had "neither the return type checked nor its side-effect”.
Coverage reports from the connman fuzz corpus, before and after the change:
- [Before](https://frankomosh.github.io/fuzz-coverage/connman-callback-coverage/before/index.html)
- [After](https://frankomosh.github.io/fuzz-coverage/connman-callback-coverage/after/index.html)
`diff cov_show_before.txt cov_show_after.txt` filtered to `ForNode`/`ForEachNode`/`IsFullOutboundConn`/`ConnectionTypeAsString`:
**`IsFullOutboundConn` — `net.h:786-788`**
```diff
- 786| 0| bool IsFullOutboundConn() const {
- 787| 0| return m_conn_type == ConnectionType::OUTBOUND_FULL_RELAY;
- 788| 0| }
+ 786| 1.13M| bool IsFullOutboundConn() const {
+ 787| 1.13M| return m_conn_type == ConnectionType::OUTBOUND_FULL_RELAY;
+ 788| 1.13M| }
```
**`ConnectionTypeAsString` — `net.h:967`**
```diff
- 967| 0| std::string ConnectionTypeAsString() const { return ::ConnectionTypeAsString(m_conn_type); }
+ 967| 1.11M| std::string ConnectionTypeAsString() const { return ::ConnectionTypeAsString(m_conn_type); }
```
**`ForNode` — `net.cpp:4126-4131`**
```diff
- 4126| 1.08k| if(pnode->GetId() == id) {
- | Branch (4126:12): [True: 0, False: 1.08k]
- 4127| 0| found = pnode;
- 4131| 39| return found != nullptr && NodeFullyConnected(found) && func(found);
- ^0 ^0
+ 4126| 602| if(pnode->GetId() == id) {
+ | Branch (4126:12): [True: 1, False: 601]
+ 4127| 1| found = pnode;
+ 4131| 28| return found != nullptr && NodeFullyConnected(found) && func(found);
+ ^1 ^1
```
**`ForEachNode` — `net.h:1270-1271`**
```diff
- 1270| 1.13M| if (NodeFullyConnected(node))
- | Branch (1270:17): [True: 0, False: 1.13M]
- 1271| 0| func(node);
+ 1270| 1.11M| if (NodeFullyConnected(node))
+ | Branch (1270:17): [True: 1.11M, False: 0]
+ 1271| 1.11M| func(node);
```
Two previously uncovered functions (`IsFullOutboundConn`, `ConnectionTypeAsString`) are now exercised through the iteration callbacks. `ForNode` finds matching nodes.
ACKs for top commit:
nervana21:
tACK 371eac8069
maflcko:
lgtm ACK 371eac8069
Tree-SHA512: 3587c021b16e38ca252676a21b66c5383ab2bd3eec9073e61e9a93db7ef84a94ce5a0c037ac512483680cafabb44103b86df0893e8a9b1bf63b8383bd54f4641
2026-05-19 15:32:56 +01:00
..
2026-03-20 15:37:51 +00:00
2025-12-16 22:21:15 +01:00
2026-03-25 16:55:18 +01:00
2026-01-20 23:59:43 +01:00
2026-01-20 23:59:41 +01:00
2025-12-16 22:21:15 +01:00
2026-03-10 11:01:37 +01:00
2026-04-29 14:51:47 -07:00
2026-04-08 16:08:54 -04:00
2025-12-16 22:21:15 +01:00
2026-01-14 11:38:07 -08:00
2026-04-20 08:55:51 +02:00
2026-04-20 11:15:41 +02:00
2026-02-06 07:56:57 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-02-17 21:40:46 +05:30
2025-12-16 22:21:15 +01:00
2026-02-27 08:37:33 -05:00
2026-04-27 11:23:25 -04:00
2026-05-17 13:26:23 -04:00
2026-04-08 22:36:13 +02:00
2026-05-06 09:39:07 +02:00
2026-05-05 10:53:04 +03:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-04-20 11:15:41 +02:00
2025-12-16 22:21:15 +01:00
2026-02-02 15:20:47 -08:00
2026-04-29 14:51:47 -07:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-07-07 10:39:45 +02:00
2026-02-27 08:37:33 -05:00
2026-02-27 08:37:33 -05:00
2026-02-13 10:52:25 +01:00
2025-12-16 22:21:15 +01:00
2026-03-26 14:41:57 +01:00
2025-12-16 22:21:15 +01:00
2026-01-31 08:45:10 +03:00
2025-12-16 22:21:15 +01:00
2026-03-10 11:01:37 +01:00
2025-08-11 16:47:51 +01:00
2025-12-16 22:21:15 +01:00
2026-03-24 16:03:02 -07:00
2026-01-20 15:47:17 -08:00
2025-12-16 22:21:15 +01:00
2025-05-30 10:12:38 -04:00
2025-12-16 22:21:15 +01:00
2026-03-10 11:01:37 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-03-25 13:51:01 +01:00
2026-02-02 15:20:51 -08:00
2025-12-16 22:21:15 +01:00
2025-10-09 20:47:25 +02:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-03-10 11:01:37 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-04-13 09:49:13 +02:00
2026-03-10 11:01:37 +01:00
2026-04-27 11:36:19 -04:00
2026-03-31 09:48:06 +02:00
2026-05-13 18:27:48 +02:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-03-10 11:01:37 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-11-25 10:35:11 +00:00
2026-04-20 11:15:41 +02:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-05-13 18:27:48 +02:00
2026-05-13 18:27:48 +02:00
2025-12-16 22:21:15 +01:00
2026-04-29 15:04:22 -07:00
2025-12-16 22:21:15 +01:00
2026-04-30 11:35:53 -07:00
2025-12-16 22:21:15 +01:00
2026-04-29 14:51:47 -07:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-02-06 07:56:57 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2026-04-20 21:18:03 -03:00
2026-04-20 11:15:41 +02:00
2025-12-16 22:21:15 +01:00
2026-04-28 17:43:03 +02:00
2026-04-20 21:18:03 -03:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-12-16 22:21:15 +01:00
2025-08-14 10:17:32 +10:00
2025-12-16 22:21:15 +01:00
2026-03-10 11:01:37 +01:00
2026-04-22 16:45:31 +10:00
2025-12-16 22:21:15 +01:00
2026-04-22 17:58:25 +10:00
2026-02-17 15:02:40 -05:00
2026-04-03 22:00:29 +02:00
2026-04-08 22:36:13 +02:00
2026-02-06 07:56:57 +01:00
2026-02-06 07:56:57 +01:00
2026-05-13 18:27:48 +02:00
2026-03-10 11:01:37 +01:00
2026-02-27 08:38:01 -05:00
2026-05-14 12:32:04 +01:00
2025-12-16 22:21:15 +01:00
2026-03-25 16:55:18 +01:00
2026-05-05 14:43:28 +02:00
2026-04-20 15:52:45 -07:00
2026-05-13 18:27:48 +02:00
2026-03-10 11:01:37 +01:00
2025-06-03 19:56:55 +02:00
2026-03-13 09:02:09 +01:00