From 9b0d2e5094626ff21c7ace6b29888ada90c43060 Mon Sep 17 00:00:00 2001 From: laanwj <126646+laanwj@users.noreply.github.com> Date: Mon, 3 Mar 2025 11:36:19 -0600 Subject: [PATCH] makeseeds: fix incorrect regex We shouldn't have | at the end of the last clause, as this will make it match the empty string too (so effectively everything starting with Satoshi: matches). While doing this, put the | at the beginning of every line of regex rather than the end, to make it easier to update in the future without accidentally running into this problem again. --- contrib/seeds/makeseeds.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/contrib/seeds/makeseeds.py b/contrib/seeds/makeseeds.py index 0f22046625e..014c13e1a63 100755 --- a/contrib/seeds/makeseeds.py +++ b/contrib/seeds/makeseeds.py @@ -34,21 +34,21 @@ PATTERN_ONION = re.compile(r"^([a-z2-7]{56}\.onion):(\d+)$") PATTERN_I2P = re.compile(r"^([a-z2-7]{52}\.b32.i2p):(\d+)$") PATTERN_AGENT = re.compile( r"^/Satoshi:(" - r"0.14.(0|1|2|3|99)|" - r"0.15.(0|1|2|99)|" - r"0.16.(0|1|2|3|99)|" - r"0.17.(0|0.1|1|2|99)|" - r"0.18.(0|1|99)|" - r"0.19.(0|1|2|99)|" - r"0.20.(0|1|2|99)|" - r"0.21.(0|1|2|99)|" - r"22.(0|1|99).0|" - r"23.(0|1|99).0|" - r"24.(0|1|2|99).(0|1)|" - r"25.(0|1|2|99).0|" - r"26.(0|1|99).0|" - r"27.(0|1|99).0|" - r"28.(0|99).0|" + r"0.14.(0|1|2|3|99)" + r"|0.15.(0|1|2|99)" + r"|0.16.(0|1|2|3|99)" + r"|0.17.(0|0.1|1|2|99)" + r"|0.18.(0|1|99)" + r"|0.19.(0|1|2|99)" + r"|0.20.(0|1|2|99)" + r"|0.21.(0|1|2|99)" + r"|22.(0|1|99).0" + r"|23.(0|1|99).0" + r"|24.(0|1|2|99).(0|1)" + r"|25.(0|1|2|99).0" + r"|26.(0|1|99).0" + r"|27.(0|1|99).0" + r"|28.(0|99).0" r")") def parseline(line: str) -> Union[dict, None]: