1
0

network: allow mixed protocols among interfaces

Previously all the interfaces used either "t" or "s".
Now the network only tries to use "s" for all interfaces, except for
the main interface, which the user can manually specify to use "t".
(so e.g. if you run with "--server localhost:50002:t", the main server will use "t",
but all the rest will use "s")
This commit is contained in:
SomberNight
2020-04-16 19:56:30 +02:00
parent 872380a525
commit adc3784bc2
4 changed files with 34 additions and 41 deletions

View File

@@ -17,7 +17,7 @@ network.start()
async def f():
try:
peers = await network.get_peers()
peers = filter_protocol(peers, 's')
peers = filter_protocol(peers)
results = await network.send_multiple_requests(peers, 'blockchain.headers.subscribe', [])
for server, header in sorted(results.items(), key=lambda x: x[1].get('height')):
height = header.get('height')

View File

@@ -23,7 +23,7 @@ network.start()
async def f():
try:
peers = await network.get_peers()
peers = filter_protocol(peers, 's')
peers = filter_protocol(peers)
results = await network.send_multiple_requests(peers, 'blockchain.transaction.get', [txid])
r1, r2 = [], []
for k, v in results.items():