Skip to content

Commit

Permalink
Merge lrpc and prpc and make the node choice more flexible
Browse files Browse the repository at this point in the history
  • Loading branch information
amzid committed Oct 26, 2019
1 parent c4c5c9f commit c96321e
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 534 deletions.
6 changes: 6 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ The most common use case is to run in mainnet and start to make payments from la
python3 src/main.py
```

TRD necessitates an interface to get provided with income and delegator data in order to perform the needed calculations.
The default provider is the public rpc node mainnet.tezrpc.me. However, it is possible to change the data provider with the flag -P rpc.
Please note that in this case, the default node would be localhost:8732. In order to change the node url for the provider, you can give the desired url
under the flag -A followed with node_url:port (e.g. -P rpc -A 127.0.0.1:8733).
Please note that the node should be an archive node, and that the port should be the rpc port specified while launching the node.

For more example commands please see wiki page:

https://github.com/habanoz/tezos-reward-distributor/wiki/How-to-Run
Expand Down
8 changes: 3 additions & 5 deletions src/api/provider_factory.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from rpc.lrpc_reward_api import LRpcRewardApiImpl
from rpc.prpc_reward_api import PRpcRewardApiImpl
from rpc.rpc_block_api import RpcBlockApiImpl
from rpc.rpc_reward_api import RpcRewardApiImpl
from tzscan.tzscan_mirror_selection_helper import TzScanMirrorSelector
Expand All @@ -16,12 +14,12 @@ def __init__(self, provider, verbose=False):
self.mirror_selector = None
self.verbose = verbose

def newRewardApi(self, network_config, baking_address, wllt_clnt_mngr, node_url):
def newRewardApi(self, network_config, baking_address, node_url):
if self.provider == 'rpc':
return LRpcRewardApiImpl(network_config, baking_address, node_url, wllt_clnt_mngr, validate=False, verbose=self.verbose)
return RpcRewardApiImpl(network_config, baking_address, node_url, protocol='http', validate=False, verbose=self.verbose)
elif self.provider == 'prpc':
url_prefix = self.url_prefixes[network_config['NAME']]
return PRpcRewardApiImpl(network_config, baking_address, self.URL.format(url_prefix), validate=False, verbose=self.verbose)
return RpcRewardApiImpl(network_config, baking_address, self.URL.format(url_prefix), protocol='https', validate=False, verbose=self.verbose)
elif self.provider == 'tzscan':
if not self.mirror_selector:
self.init_mirror_selector(network_config)
Expand Down
2 changes: 1 addition & 1 deletion src/pay/payment_producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(self, name, initial_payment_cycle, network_config, payments_dir, ca

self.name = name

self.reward_api = provider_factory.newRewardApi(network_config, self.baking_address, wllt_clnt_mngr, node_url)
self.reward_api = provider_factory.newRewardApi(network_config, self.baking_address, node_url)
self.block_api = provider_factory.newBlockApi(network_config, wllt_clnt_mngr, node_url)

self.fee_calc = service_fee_calc
Expand Down
211 changes: 0 additions & 211 deletions src/rpc/lrpc_reward_api.py

This file was deleted.

Loading

0 comments on commit c96321e

Please sign in to comment.