Skip to content

Add metric for large inv sets (>35) sent to peers - #235

Merged
0xB10C merged 1 commit into
peer-observer:masterfrom
jurraca:add-large-invs
Aug 27, 2025
Merged

0xB10C merged 1 commit into
peer-observer:masterfrom
jurraca:add-large-invs

Conversation

@jurraca

@jurraca jurraca commented Aug 25, 2025

Copy link
Copy Markdown
Contributor

Adds a metric to track inv sets larger than 35 called p2p_invs_outbound_large.

closes #220

Comment thread tools/metrics/src/metrics.rs Resolved
Comment thread tools/metrics/src/lib.rs Resolved
@jurraca

jurraca commented Aug 26, 2025

Copy link
Copy Markdown
Contributor Author

Updated, removing the label and turning the metric from an IntCounterVec to an IntCounter. Also handles WTx as suggested above and updates the test accordingly.

Question: a peer can either send Transaction or Wtx but not both in the same Inv ?

@0xB10C

0xB10C commented Aug 26, 2025

Copy link
Copy Markdown
Collaborator

Question: a peer can either send Transaction or Wtx but not both in the same Inv ?

In practice, we should send peers either a Transaction OR a Wtx INV since we have negotiated with the peer if it supports Wtxid-relay (see https://github.com/bitcoin/bips/blob/master/bip-0339.mediawiki). However, there might be edge cases I'm not aware of. And an inbound message can obviously contain anything a weird, custom client might send.

We have the peerobserver_p2p_invs_heterogeneous metric, and I see some heterogeneous INVs every couple of hours, but I don't remember what these are and why these are send/received. Could probably find that out with a modified metrics tool or custom logger tool.

@0xB10C

0xB10C commented Aug 27, 2025

Copy link
Copy Markdown
Collaborator

Thank you - this looks good. I'll merge it and run this for a few days. Then we can follow up with a Grafana dashboard.

@0xB10C
0xB10C merged commit a536c3b into peer-observer:master Aug 27, 2025
@jurraca
jurraca deleted the add-large-invs branch August 27, 2025 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

metrics tool: keep track of tx INVs with more than 35 entries (DoS due to inv-to-send sets growing too large)

2 participants