add options to set server description, payment address and daily fee
This commit is contained in:
parent
826f584aa8
commit
64eaa5e3aa
4 changed files with 37 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
import logging
|
||||
import os
|
||||
import asyncio
|
||||
from unittest.mock import Mock
|
||||
|
||||
|
@ -16,6 +17,33 @@ class NetworkTests(IntegrationTestCase):
|
|||
await self.ledger.network.on_header.first
|
||||
self.assertEqual(self.ledger.network.remote_height, initial_height + 1)
|
||||
|
||||
async def test_server_features(self):
|
||||
self.assertEqual({'genesis_hash': self.conductor.spv_node.coin_class.GENESIS_HASH,
|
||||
'hash_function': 'sha256',
|
||||
'hosts': {},
|
||||
'protocol_max': '1.4',
|
||||
'protocol_min': '1.1',
|
||||
'pruning': None,
|
||||
'description': '',
|
||||
'payment_address': '',
|
||||
'daily_fee': 0,
|
||||
'server_version': '0.5.7'}, await self.ledger.network.get_server_features())
|
||||
await self.conductor.spv_node.stop()
|
||||
address = (await self.account.get_addresses(limit=1))[0]
|
||||
os.environ.update({'DESCRIPTION': 'Fastest server in the west.', 'PAYMENT_ADDRESS': address, 'DAILY_FEE': '42'})
|
||||
await self.conductor.spv_node.start(self.conductor.blockchain_node)
|
||||
await self.ledger.network.on_connected.first
|
||||
self.assertEqual({'genesis_hash': self.conductor.spv_node.coin_class.GENESIS_HASH,
|
||||
'hash_function': 'sha256',
|
||||
'hosts': {},
|
||||
'protocol_max': '1.4',
|
||||
'protocol_min': '1.1',
|
||||
'pruning': None,
|
||||
'description': 'Fastest server in the west.',
|
||||
'payment_address': address,
|
||||
'daily_fee': 42,
|
||||
'server_version': '0.5.7'}, await self.ledger.network.get_server_features())
|
||||
|
||||
|
||||
class ReconnectTests(IntegrationTestCase):
|
||||
|
||||
|
|
|
@ -258,6 +258,9 @@ class BaseNetwork:
|
|||
self.client.abort()
|
||||
raise asyncio.CancelledError()
|
||||
|
||||
def get_server_features(self):
|
||||
return self.rpc('server.features', (), restricted=True)
|
||||
|
||||
|
||||
class SessionPool:
|
||||
|
||||
|
|
|
@ -80,6 +80,9 @@ class Env:
|
|||
self.bandwidth_limit = self.integer('BANDWIDTH_LIMIT', 2000000)
|
||||
self.session_timeout = self.integer('SESSION_TIMEOUT', 600)
|
||||
self.drop_client = self.custom("DROP_CLIENT", None, re.compile)
|
||||
self.description = self.default('DESCRIPTION', '')
|
||||
self.payment_address = self.default('PAYMENT_ADDRESS', '')
|
||||
self.daily_fee = self.integer('DAILY_FEE', 0)
|
||||
|
||||
# Identities
|
||||
clearnet_identity = self.clearnet_identity()
|
||||
|
|
|
@ -767,6 +767,9 @@ class ElectrumX(SessionBase):
|
|||
'protocol_min': min_str,
|
||||
'protocol_max': max_str,
|
||||
'genesis_hash': env.coin.GENESIS_HASH,
|
||||
'description': env.description,
|
||||
'payment_address': env.payment_address,
|
||||
'daily_fee': env.daily_fee,
|
||||
'hash_function': 'sha256',
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue