mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-30 08:51:32 +00:00
simplify parameters, add lndhost to config
This commit is contained in:
parent
0abfcd2b6a
commit
fe1a1b27c6
1 changed files with 11 additions and 12 deletions
|
@ -32,8 +32,6 @@ NETWORK = None
|
||||||
CONFIG = None
|
CONFIG = None
|
||||||
locked = set()
|
locked = set()
|
||||||
|
|
||||||
#machine = "148.251.87.112"
|
|
||||||
machine = "127.0.0.1"
|
|
||||||
|
|
||||||
def WriteDb(json):
|
def WriteDb(json):
|
||||||
req = rpc_pb2.WriteDbRequest()
|
req = rpc_pb2.WriteDbRequest()
|
||||||
|
@ -602,6 +600,7 @@ class LightningRPC:
|
||||||
self.queue = queue.Queue()
|
self.queue = queue.Queue()
|
||||||
self.subscribers = []
|
self.subscribers = []
|
||||||
self.console = None
|
self.console = None
|
||||||
|
|
||||||
# overridden
|
# overridden
|
||||||
async def run(self, netAndWalLock):
|
async def run(self, netAndWalLock):
|
||||||
while asyncio.get_event_loop().is_running():
|
while asyncio.get_event_loop().is_running():
|
||||||
|
@ -612,6 +611,7 @@ class LightningRPC:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
def lightningRpcNetworkRequestThreadTarget(qitem):
|
def lightningRpcNetworkRequestThreadTarget(qitem):
|
||||||
|
machine = CONFIG.get('lndhost', '127.0.0.1')
|
||||||
applyMethodName = lambda x: functools.partial(x, qitem.methodName)
|
applyMethodName = lambda x: functools.partial(x, qitem.methodName)
|
||||||
client = Server("http://" + machine + ":8090")
|
client = Server("http://" + machine + ":8090")
|
||||||
argumentStrings = [str(x) for x in qitem.args]
|
argumentStrings = [str(x) for x in qitem.args]
|
||||||
|
@ -666,7 +666,7 @@ class LightningWorker:
|
||||||
self.wallet = wallet
|
self.wallet = wallet
|
||||||
self.network = network
|
self.network = network
|
||||||
self.config = config
|
self.config = config
|
||||||
ks = self.wallet().keystore
|
ks = self.wallet.keystore
|
||||||
assert hasattr(ks, "xprv"), "Wallet must have xprv, can't be e.g. imported"
|
assert hasattr(ks, "xprv"), "Wallet must have xprv, can't be e.g. imported"
|
||||||
try:
|
try:
|
||||||
xprv = ks.get_master_private_key(None)
|
xprv = ks.get_master_private_key(None)
|
||||||
|
@ -677,8 +677,7 @@ class LightningWorker:
|
||||||
privKey = tupl[-1]
|
privKey = tupl[-1]
|
||||||
assert type(privKey) is type(bytes([]))
|
assert type(privKey) is type(bytes([]))
|
||||||
privateKeyHash = bitcoin.Hash(privKey)
|
privateKeyHash = bitcoin.Hash(privKey)
|
||||||
|
deser = bitcoin.deserialize_xpub(wallet.keystore.xpub)
|
||||||
deser = bitcoin.deserialize_xpub(wallet().keystore.xpub)
|
|
||||||
assert deser[0] == "p2wpkh", deser
|
assert deser[0] == "p2wpkh", deser
|
||||||
self.subscribers = []
|
self.subscribers = []
|
||||||
|
|
||||||
|
@ -688,15 +687,14 @@ class LightningWorker:
|
||||||
global globalIdx
|
global globalIdx
|
||||||
|
|
||||||
wasAlreadyUpToDate = False
|
wasAlreadyUpToDate = False
|
||||||
|
|
||||||
while asyncio.get_event_loop().is_running():
|
while asyncio.get_event_loop().is_running():
|
||||||
WALLET = self.wallet()
|
WALLET = self.wallet
|
||||||
NETWORK = self.network()
|
NETWORK = self.network
|
||||||
CONFIG = self.config()
|
CONFIG = self.config
|
||||||
|
machine = CONFIG.get('lndhost', '127.0.0.1')
|
||||||
globalIdx = WALLET.storage.get("lightning_global_key_index", 0)
|
globalIdx = WALLET.storage.get("lightning_global_key_index", 0)
|
||||||
if globalIdx != 0: print("initial lightning global key index", globalIdx)
|
if globalIdx != 0:
|
||||||
|
print("initial lightning global key index", globalIdx)
|
||||||
writer = None
|
writer = None
|
||||||
print("OPENING CONNECTION")
|
print("OPENING CONNECTION")
|
||||||
try:
|
try:
|
||||||
|
@ -718,6 +716,7 @@ class LightningWorker:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
await asyncio.sleep(5)
|
await asyncio.sleep(5)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
def subscribe(self, notifyFunction):
|
def subscribe(self, notifyFunction):
|
||||||
self.subscribers.append(functools.partial(notifyFunction, "LightningWorker"))
|
self.subscribers.append(functools.partial(notifyFunction, "LightningWorker"))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue