Skip to content

Commit

Permalink
Merge branch 'bitcoin' into auxpow
Browse files Browse the repository at this point in the history
  • Loading branch information
domob1812 committed Mar 11, 2024
2 parents 9d05e57 + 55bd5d8 commit 3c022b7
Show file tree
Hide file tree
Showing 107 changed files with 21,141 additions and 10,798 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -289,4 +289,5 @@ jobs:
- name: Run functional tests
env:
TEST_RUNNER_EXTRA: ${{ github.event_name != 'pull_request' && '--extended' || '' }}
run: py -3 test\functional\test_runner.py --jobs $env:NUMBER_OF_PROCESSORS --ci --quiet --tmpdirprefix=$env:RUNNER_TEMP --combinedlogslen=99999999 --timeout-factor=$env:TEST_RUNNER_TIMEOUT_FACTOR $env:TEST_RUNNER_EXTRA
shell: cmd
run: py -3 test\functional\test_runner.py --jobs %NUMBER_OF_PROCESSORS% --ci --quiet --tmpdirprefix=%RUNNER_TEMP% --combinedlogslen=99999999 --timeout-factor=%TEST_RUNNER_TIMEOUT_FACTOR% %TEST_RUNNER_EXTRA%
8 changes: 1 addition & 7 deletions build_msvc/test_bitcoin-qt/test_bitcoin-qt.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,13 @@
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\src\init\bitcoin-qt.cpp" />
<ClCompile Include="..\..\src\test\util\setup_common.cpp" />
<ClCompile Include="..\..\src\wallet\test\util.cpp">
<ObjectFileName>$(IntDir)wallet_test_util.obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\..\src\qt\test\addressbooktests.cpp" />
<ClCompile Include="..\..\src\qt\test\apptests.cpp" />
<ClCompile Include="..\..\src\qt\test\optiontests.cpp" />
<ClCompile Include="..\..\src\qt\test\rpcnestedtests.cpp" />
<ClCompile Include="..\..\src\qt\test\test_main.cpp" />
<ClCompile Include="..\..\src\qt\test\uritests.cpp" />
<ClCompile Include="..\..\src\qt\test\util.cpp">
<ObjectFileName>$(IntDir)qt_test_util.obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\..\src\qt\test\util.cpp" />
<ClCompile Include="..\..\src\qt\test\wallettests.cpp" />
<ClCompile Include="..\..\src\wallet\test\wallet_test_fixture.cpp" />
<ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_addressbooktests.cpp" />
Expand Down
21 changes: 16 additions & 5 deletions contrib/seeds/makeseeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
PATTERN_IPV4 = re.compile(r"^((\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})):(\d+)$")
PATTERN_IPV6 = re.compile(r"^\[([0-9a-z:]+)\]:(\d+)$")
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)|"
Expand All @@ -40,7 +41,8 @@
r"22.(0|1|99)|"
r"23.(0|1|99)|"
r"24.(0|1|99)|"
r"25.99"
r"25.(0|1|99)|"
r"26.(0|99)|"
r")")

def parseline(line: str) -> Union[dict, None]:
Expand All @@ -65,7 +67,13 @@ def parseline(line: str) -> Union[dict, None]:
if m is None:
m = PATTERN_ONION.match(sline[0])
if m is None:
return None
m = PATTERN_I2P.match(sline[0])
if m is None:
return None
else:
net = 'i2p'
ipstr = sortkey = m.group(1)
port = int(m.group(2))
else:
net = 'onion'
ipstr = sortkey = m.group(1)
Expand Down Expand Up @@ -140,6 +148,7 @@ def filterbyasn(asmap: ASMap, ips: list[dict], max_per_asn: dict, max_per_net: i
# Sift out ips by type
ips_ipv46 = [ip for ip in ips if ip['net'] in ['ipv4', 'ipv6']]
ips_onion = [ip for ip in ips if ip['net'] == 'onion']
ips_i2p = [ip for ip in ips if ip['net'] == 'i2p']

# Filter IPv46 by ASN, and limit to max_per_net per network
result = []
Expand All @@ -163,6 +172,7 @@ def filterbyasn(asmap: ASMap, ips: list[dict], max_per_asn: dict, max_per_net: i

# Add back Onions (up to max_per_net)
result.extend(ips_onion[0:max_per_net])
result.extend(ips_i2p[0:max_per_net])
return result

def ip_stats(ips: list[dict]) -> str:
Expand All @@ -172,7 +182,7 @@ def ip_stats(ips: list[dict]) -> str:
if ip is not None:
hist[ip['net']] += 1

return f"{hist['ipv4']:6d} {hist['ipv6']:6d} {hist['onion']:6d}"
return f"{hist['ipv4']:6d} {hist['ipv6']:6d} {hist['onion']:6d} {hist['i2p']:6d}"

def parse_args():
argparser = argparse.ArgumentParser(description='Generate a list of bitcoin node seed ip addresses.')
Expand All @@ -194,7 +204,7 @@ def main():
ips = [parseline(line) for line in lines]
print('Done.', file=sys.stderr)

print('\x1b[7m IPv4 IPv6 Onion Pass \x1b[0m', file=sys.stderr)
print('\x1b[7m IPv4 IPv6 Onion I2P Pass \x1b[0m', file=sys.stderr)
print(f'{ip_stats(ips):s} Initial', file=sys.stderr)
# Skip entries with invalid address.
ips = [ip for ip in ips if ip is not None]
Expand All @@ -208,11 +218,12 @@ def main():
# Require service bit 1.
ips = [ip for ip in ips if (ip['service'] & 1) == 1]
print(f'{ip_stats(ips):s} Require service bit 1', file=sys.stderr)
# Require at least 50% 30-day uptime for clearnet, 10% for onion.
# Require at least 50% 30-day uptime for clearnet, 10% for onion and i2p.
req_uptime = {
'ipv4': 50,
'ipv6': 50,
'onion': 10,
'i2p' : 10,
}
ips = [ip for ip in ips if ip['uptime'] > req_uptime[ip['net']]]
print(f'{ip_stats(ips):s} Require minimum uptime', file=sys.stderr)
Expand Down
Loading

0 comments on commit 3c022b7

Please sign in to comment.