3
3
Simple script to check the status of all Bitcoin Core DNS seeds.
4
4
Seeds are available from https://github.com/bitcoin/bitcoin/blob/master/src/kernel/chainparams.cpp
5
5
'''
6
+ import argparse
6
7
import subprocess
7
8
from itertools import combinations
8
9
@@ -69,7 +70,7 @@ def get_combinations(services):
69
70
70
71
def check_dns_support (combination_hex , provider ):
71
72
"""
72
- Checks if a DNS provider supports a given combination of flags.
73
+ Checks if a DNS provider supports a given combination of service flags.
73
74
"""
74
75
75
76
domain = f"x{ combination_hex } .{ provider } "
@@ -82,6 +83,11 @@ def check_dns_support(combination_hex, provider):
82
83
return False
83
84
84
85
if __name__ == "__main__" :
86
+ parser = argparse .ArgumentParser (description = 'Bitcoin Core Filter DNS Seeds' )
87
+ parser .add_argument ('--filter-services' , action = 'store_true' , help = 'Scan which filters are in use' )
88
+ args = parser .parse_args ()
89
+
90
+
85
91
print ("\n Bitcoin Core DNS Seed Status Check:\n " )
86
92
87
93
for (network , seeds ) in SEEDS_PER_NETWORK .items ():
@@ -93,23 +99,24 @@ def check_dns_support(combination_hex, provider):
93
99
print ()
94
100
95
101
print ("\n " )
96
- combinations = get_combinations ({
97
- "NODE_NONE" : NODE_NONE ,
98
- "NODE_NETWORK" : NODE_NETWORK ,
99
- "NODE_BLOOM" : NODE_BLOOM ,
100
- "NODE_WITNESS" : NODE_WITNESS ,
101
- "NODE_COMPACT_FILTERS" : NODE_COMPACT_FILTERS ,
102
- "NODE_NETWORK_LIMITED" : NODE_NETWORK_LIMITED ,
103
- "NODE_P2P_V2" : NODE_P2P_V2 ,
104
- })
105
-
106
- print ("All possible combinations of node services and their bit flags in hexadecimal:" )
107
- for combination_hex , service_names in combinations :
108
- print (f" Bit flag (hex): { combination_hex } - Service: { ', ' .join (service_names )} " )
109
-
110
- for (network , seeds ) in SEEDS_PER_NETWORK .items ():
111
- for hostname in seeds :
112
- supports_combination = check_dns_support (combination_hex , hostname )
113
- print (f" Network: { network } , Provider: { hostname } - Supports Service: { supports_combination } " )
114
-
115
-
102
+
103
+ if args .filter_services :
104
+ combinations = get_combinations ({
105
+ "NODE_NONE" : NODE_NONE ,
106
+ "NODE_NETWORK" : NODE_NETWORK ,
107
+ "NODE_BLOOM" : NODE_BLOOM ,
108
+ "NODE_WITNESS" : NODE_WITNESS ,
109
+ "NODE_COMPACT_FILTERS" : NODE_COMPACT_FILTERS ,
110
+ "NODE_NETWORK_LIMITED" : NODE_NETWORK_LIMITED ,
111
+ "NODE_P2P_V2" : NODE_P2P_V2 ,
112
+ })
113
+
114
+ print ("All possible combinations of node services and their bit flags in hexadecimal:" )
115
+ for combination_hex , service_names in combinations :
116
+ print (f" Bit flag (hex): { combination_hex } - Service: { ', ' .join (service_names )} " )
117
+
118
+ for (network , seeds ) in SEEDS_PER_NETWORK .items ():
119
+ for hostname in seeds :
120
+ supports_combination = check_dns_support (combination_hex , hostname )
121
+ print (f" Network: { network } , Provider: { hostname } - Supports Service: { supports_combination } " )
122
+
0 commit comments