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.
This commit is contained in:
laanwj 2025-03-03 11:36:19 -06:00 committed by Jon Atack
parent a9a2b669f3
commit 9b0d2e5094

View file

@ -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]: