Changeset View
Changeset View
Standalone View
Standalone View
contrib/seeds/generate-seeds.py
Show All 16 Lines | These files must consist of lines in the format | ||||
<ip>:<port> | <ip>:<port> | ||||
[<ipv6>] | [<ipv6>] | ||||
[<ipv6>]:<port> | [<ipv6>]:<port> | ||||
<onion>.onion | <onion>.onion | ||||
0xDDBBCCAA (IPv4 little-endian old pnSeeds format) | 0xDDBBCCAA (IPv4 little-endian old pnSeeds format) | ||||
The output will be two data structures with the peers in binary format: | The output will be two data structures with the peers in binary format: | ||||
static SeedSpec6 pnSeed6_main[]={ | static std::vector<SeedSpec6> pnSeed6_main = { | ||||
... | ... | ||||
} | } | ||||
static SeedSpec6 pnSeed6_test[]={ | static std::vector<SeedSpec6> pnSeed6_test = { | ||||
... | ... | ||||
} | } | ||||
These should be pasted into `src/chainparamsseeds.h`. | These should be pasted into `src/chainparamsseeds.h`. | ||||
''' | ''' | ||||
from base64 import b32decode | from base64 import b32decode | ||||
from binascii import a2b_hex | from binascii import a2b_hex | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | else: | ||||
port = int(port) | port = int(port) | ||||
host = name_to_ipv6(host) | host = name_to_ipv6(host) | ||||
return (host, port) | return (host, port) | ||||
def process_nodes(g, f, structname, defaultport): | def process_nodes(g, f, structname, defaultport): | ||||
g.write('static SeedSpec6 {}[] = {{\n'.format(structname)) | g.write('static std::vector<SeedSpec6> {} = {{\n'.format(structname)) | ||||
first = True | first = True | ||||
for line in f: | for line in f: | ||||
comment = line.find('#') | comment = line.find('#') | ||||
if comment != -1: | if comment != -1: | ||||
line = line[0:comment] | line = line[0:comment] | ||||
line = line.strip() | line = line.strip() | ||||
if not line: | if not line: | ||||
continue | continue | ||||
Show All 39 Lines |