Skip to content

Commit 9b0d2e5

Browse files
laanwjjonatack
authored andcommitted
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.
1 parent a9a2b66 commit 9b0d2e5

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

contrib/seeds/makeseeds.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,21 @@
3434
PATTERN_I2P = re.compile(r"^([a-z2-7]{52}\.b32.i2p):(\d+)$")
3535
PATTERN_AGENT = re.compile(
3636
r"^/Satoshi:("
37-
r"0.14.(0|1|2|3|99)|"
38-
r"0.15.(0|1|2|99)|"
39-
r"0.16.(0|1|2|3|99)|"
40-
r"0.17.(0|0.1|1|2|99)|"
41-
r"0.18.(0|1|99)|"
42-
r"0.19.(0|1|2|99)|"
43-
r"0.20.(0|1|2|99)|"
44-
r"0.21.(0|1|2|99)|"
45-
r"22.(0|1|99).0|"
46-
r"23.(0|1|99).0|"
47-
r"24.(0|1|2|99).(0|1)|"
48-
r"25.(0|1|2|99).0|"
49-
r"26.(0|1|99).0|"
50-
r"27.(0|1|99).0|"
51-
r"28.(0|99).0|"
37+
r"0.14.(0|1|2|3|99)"
38+
r"|0.15.(0|1|2|99)"
39+
r"|0.16.(0|1|2|3|99)"
40+
r"|0.17.(0|0.1|1|2|99)"
41+
r"|0.18.(0|1|99)"
42+
r"|0.19.(0|1|2|99)"
43+
r"|0.20.(0|1|2|99)"
44+
r"|0.21.(0|1|2|99)"
45+
r"|22.(0|1|99).0"
46+
r"|23.(0|1|99).0"
47+
r"|24.(0|1|2|99).(0|1)"
48+
r"|25.(0|1|2|99).0"
49+
r"|26.(0|1|99).0"
50+
r"|27.(0|1|99).0"
51+
r"|28.(0|99).0"
5252
r")")
5353

5454
def parseline(line: str) -> Union[dict, None]:

0 commit comments

Comments
 (0)