gossipd: check for existing channel announcement before sigcheck#8322
Conversation
Checking a signature is a CPU-intensive operation that should be performed only if gossmap doesn't already have the channel announcement in question and we're not already checking for the announcement's UTxO. Changelog-Fixed: `gossipd` doesn't waste CPU cycles checking signatures on channel announcements that are already known Issue: ElementsProject#7972
cdecker
left a comment
There was a problem hiding this comment.
ACK
I guess the assumption was that seeking in the gossmap for the node would be more expensive than the signature check. But if experiments show that not to be true, this is good.
A few syscalls to read from an open file descriptor (especially when the requested pages are already hot in cache) constitute much less work than checking an ECDSA signature. EDIT: Actually, looking at the perf report, it looks as though gossipd mmaps the gossip store, so that's even better. Instead of a few syscalls to read from an open file descriptor, you only have potentially a few page faults to fetch pages of a mapped file in the worst case and only hot memory reads in the best case. Not even close to the same order of magnitude as ECDSA signature verification. Note: |
3f6cd59
into
ElementsProject:master
Checking a signature is a CPU-intensive operation that should be performed only if gossmap doesn't already have the channel announcement in question and we're not already checking for the announcement's UTxO.
Changelog-Fixed:
gossipddoesn't waste CPU cycles checking signatures on channel announcements that are already knownIssue: #7972
Checklist
Before submitting the PR, ensure the following tasks are completed. If an item is not applicable to your PR, please mark it as checked: