forked from LBRYCommunity/lbry-sdk
use both donation and payment addresses separately
This commit is contained in:
parent
ad6c6fbe35
commit
ae9ba14b59
3 changed files with 14 additions and 3 deletions
|
@ -73,6 +73,7 @@ class Env:
|
||||||
self.tor_proxy_port = self.integer('TOR_PROXY_PORT', None)
|
self.tor_proxy_port = self.integer('TOR_PROXY_PORT', None)
|
||||||
# The electrum client takes the empty string as unspecified
|
# The electrum client takes the empty string as unspecified
|
||||||
self.payment_address = self.default('PAYMENT_ADDRESS', '')
|
self.payment_address = self.default('PAYMENT_ADDRESS', '')
|
||||||
|
self.donation_address = self.default('DONATION_ADDRESS', '')
|
||||||
# Server limits to help prevent DoS
|
# Server limits to help prevent DoS
|
||||||
self.max_send = self.integer('MAX_SEND', 1000000)
|
self.max_send = self.integer('MAX_SEND', 1000000)
|
||||||
self.max_subs = self.integer('MAX_SUBS', 250000)
|
self.max_subs = self.integer('MAX_SUBS', 250000)
|
||||||
|
|
|
@ -801,6 +801,7 @@ class LBRYElectrumX(SessionBase):
|
||||||
'server.add_peer': cls.add_peer,
|
'server.add_peer': cls.add_peer,
|
||||||
'server.banner': cls.banner,
|
'server.banner': cls.banner,
|
||||||
'server.payment_address': cls.payment_address,
|
'server.payment_address': cls.payment_address,
|
||||||
|
'server.donation_address': cls.donation_address,
|
||||||
'server.features': cls.server_features_async,
|
'server.features': cls.server_features_async,
|
||||||
'server.peers.subscribe': cls.peers_subscribe,
|
'server.peers.subscribe': cls.peers_subscribe,
|
||||||
'server.version': cls.server_version,
|
'server.version': cls.server_version,
|
||||||
|
@ -855,6 +856,7 @@ class LBRYElectrumX(SessionBase):
|
||||||
'genesis_hash': env.coin.GENESIS_HASH,
|
'genesis_hash': env.coin.GENESIS_HASH,
|
||||||
'description': env.description,
|
'description': env.description,
|
||||||
'payment_address': env.payment_address,
|
'payment_address': env.payment_address,
|
||||||
|
'donation_address': env.donation_address,
|
||||||
'daily_fee': env.daily_fee,
|
'daily_fee': env.daily_fee,
|
||||||
'hash_function': 'sha256',
|
'hash_function': 'sha256',
|
||||||
}
|
}
|
||||||
|
@ -1363,6 +1365,7 @@ class LBRYElectrumX(SessionBase):
|
||||||
('$DAEMON_VERSION', daemon_version),
|
('$DAEMON_VERSION', daemon_version),
|
||||||
('$DAEMON_SUBVERSION', network_info['subversion']),
|
('$DAEMON_SUBVERSION', network_info['subversion']),
|
||||||
('$PAYMENT_ADDRESS', self.env.payment_address),
|
('$PAYMENT_ADDRESS', self.env.payment_address),
|
||||||
|
('$DONATION_ADDRESS', self.env.donation_address),
|
||||||
]:
|
]:
|
||||||
banner = banner.replace(*pair)
|
banner = banner.replace(*pair)
|
||||||
return banner
|
return banner
|
||||||
|
@ -1371,6 +1374,10 @@ class LBRYElectrumX(SessionBase):
|
||||||
"""Return the payment address as a string, empty if there is none."""
|
"""Return the payment address as a string, empty if there is none."""
|
||||||
return self.env.payment_address
|
return self.env.payment_address
|
||||||
|
|
||||||
|
async def donation_address(self):
|
||||||
|
"""Return the donation address as a string, empty if there is none."""
|
||||||
|
return self.env.donation_address
|
||||||
|
|
||||||
async def banner(self):
|
async def banner(self):
|
||||||
"""Return the server banner text."""
|
"""Return the server banner text."""
|
||||||
banner = f'You are connected to an {self.version} server.'
|
banner = f'You are connected to an {self.version} server.'
|
||||||
|
|
|
@ -28,15 +28,17 @@ class NetworkTests(IntegrationTestCase):
|
||||||
'pruning': None,
|
'pruning': None,
|
||||||
'description': '',
|
'description': '',
|
||||||
'payment_address': '',
|
'payment_address': '',
|
||||||
|
'donation_address': '',
|
||||||
'daily_fee': '0',
|
'daily_fee': '0',
|
||||||
'server_version': lbry.__version__}, await self.ledger.network.get_server_features())
|
'server_version': lbry.__version__}, await self.ledger.network.get_server_features())
|
||||||
await self.conductor.spv_node.stop()
|
await self.conductor.spv_node.stop()
|
||||||
address = (await self.account.get_addresses(limit=1))[0]
|
payment_address, donation_address = await self.account.get_addresses(limit=2)
|
||||||
await self.conductor.spv_node.start(
|
await self.conductor.spv_node.start(
|
||||||
self.conductor.blockchain_node,
|
self.conductor.blockchain_node,
|
||||||
extraconf={
|
extraconf={
|
||||||
'DESCRIPTION': 'Fastest server in the west.',
|
'DESCRIPTION': 'Fastest server in the west.',
|
||||||
'PAYMENT_ADDRESS': address,
|
'PAYMENT_ADDRESS': payment_address,
|
||||||
|
'DONATION_ADDRESS': donation_address,
|
||||||
'DAILY_FEE': '42'
|
'DAILY_FEE': '42'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -49,7 +51,8 @@ class NetworkTests(IntegrationTestCase):
|
||||||
'protocol_min': '0.54.0',
|
'protocol_min': '0.54.0',
|
||||||
'pruning': None,
|
'pruning': None,
|
||||||
'description': 'Fastest server in the west.',
|
'description': 'Fastest server in the west.',
|
||||||
'payment_address': address,
|
'payment_address': payment_address,
|
||||||
|
'donation_address': donation_address,
|
||||||
'daily_fee': '42',
|
'daily_fee': '42',
|
||||||
'server_version': lbry.__version__}, await self.ledger.network.get_server_features())
|
'server_version': lbry.__version__}, await self.ledger.network.get_server_features())
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue