makeseeds: Choose node info with most recent success when deduplicating
What changed, and why it matters
This commit fixes a small bug in an internal Bitcoin Core seed-list generator script. When the script saw the same IP address and port more than once, it used to keep whichever entry it encountered last. Now it keeps the one with the most recent successful contact. This makes the generated list of network peers slightly more accurate and reliable, but it is not a security fix for the Bitcoin software itself.
No security action required. Treat as a normal code-quality/maintenance improvement. If seed-list freshness matters for operations, ensure the updated script is used when regenerating seeds.
Security signals we found
No security-relevant signals observed in the diff or commit message
Change is confined to an auxiliary seed-list generation script
No input validation, memory safety, cryptographic, or authorization changes
Evidence from the diff
The change is in contrib/seeds/makeseeds.py, a maintenance script that produces hard-coded DNS seed fallback lists from crawler data. The dedup() function previously overwrote dictionary entries unconditionally for each (ip, port) tuple, so the surviving record depended on input order rather than freshness. The patch now compares the ‘lastsuccess’ timestamp and keeps the entry with the latest success. This is a correctness/data-quality improvement in an offline tooling path; it does not alter consensus, P2P protocol handling, wallet logic, or runtime node behavior.
Changed components
contrib/seeds/makeseeds.pyInspect captured patch +3 / −1
diff --git a/contrib/seeds/makeseeds.py b/contrib/seeds/makeseeds.py
index da73de47..2dba41ae 100755
--- a/contrib/seeds/makeseeds.py
+++ b/contrib/seeds/makeseeds.py
@@ -139,7 +139,9 @@ def dedup(ips: list[dict]) -> list[dict]:
""" Remove duplicates from `ips` where multiple ips share address and port. """
d = {}
for ip in ips:
- d[ip['ip'],ip['port']] = ip
+ ip_port = (ip["ip"], ip["port"])
+ if ip_port not in d or ip["lastsuccess"] > d[ip_port]["lastsuccess"]:
+ d[ip_port] = ip
return list(d.values())
def filtermultiport(ips: list[dict]) -> list[dict]:
Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.