Split rpc functions into new file.

This commit is contained in:
tecnovert
2020-02-02 01:18:29 +02:00
parent 0a2c6dafb7
commit adbb0268ff
7 changed files with 142 additions and 145 deletions

View File

@@ -37,9 +37,12 @@ from basicswap.basicswap import (
from basicswap.util import (
COIN,
toWIF,
callrpc_cli,
dumpje,
)
from basicswap.rpc import (
callrpc_cli,
waitForRPC,
)
from basicswap.key import (
ECKey,
)
@@ -210,17 +213,6 @@ def run_loop(self):
btcRpc('generatetoaddress 1 {}'.format(self.btc_addr))
def waitForRPC(rpc_func, wallet=None):
for i in range(5):
try:
rpc_func('getwalletinfo')
return
except Exception as ex:
logging.warning('Can\'t connect to daemon RPC: %s. Trying again in %d second/s.', str(ex), (1 + i))
time.sleep(1 + i)
raise ValueError('waitForRPC failed')
def checkForks(ro):
if 'bip9_softforks' in ro:
assert(ro['bip9_softforks']['csv']['status'] == 'active')