Browse Source

use acceptable variable names

dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
ThomasV 7 years ago
parent
commit
1bc6958c83
  1. 34
      lib/lnbase.py

34
lib/lnbase.py

@ -307,9 +307,9 @@ class Peer(PrintError):
self.pubkey = pubkey self.pubkey = pubkey
self.read_buffer = b'' self.read_buffer = b''
self.ping_time = 0 self.ping_time = 0
self.temporary_channel_id_to_incoming_accept_channel = {} self.channel_accepted = {}
self.temporary_channel_id_to_incoming_funding_signed = {} self.funding_signed = {}
self.init_message_received_future = asyncio.Future() self.initialized = asyncio.Future()
self.localfeatures = (0x08 if request_initial_sync else 0) self.localfeatures = (0x08 if request_initial_sync else 0)
# view of the network # view of the network
self.nodes = {} # received node announcements self.nodes = {} # received node announcements
@ -419,17 +419,17 @@ class Peer(PrintError):
f(payload) f(payload)
def on_error(self, payload): def on_error(self, payload):
if payload["channel_id"] in self.temporary_channel_id_to_incoming_accept_channel: if payload["channel_id"] in self.channel_accepted:
self.temporary_channel_id_to_incoming_accept_channel[payload["channel_id"]].set_exception(LightningError(payload["data"])) self.channel_accepted[payload["channel_id"]].set_exception(LightningError(payload["data"]))
if payload["channel_id"] in self.temporary_channel_id_to_incoming_funding_signed: if payload["channel_id"] in self.funding_signed:
self.temporary_channel_id_to_incoming_funding_signed[payload["channel_id"]].set_exception(LightningError(payload["data"])) self.funding_signed[payload["channel_id"]].set_exception(LightningError(payload["data"]))
def on_ping(self, payload): def on_ping(self, payload):
l = int.from_bytes(payload['num_pong_bytes'], byteorder="big") l = int.from_bytes(payload['num_pong_bytes'], byteorder="big")
self.send_message(gen_msg('pong', byteslen=l)) self.send_message(gen_msg('pong', byteslen=l))
def on_accept_channel(self, payload): def on_accept_channel(self, payload):
self.temporary_channel_id_to_incoming_accept_channel[payload["temporary_channel_id"]].set_result(payload) self.channel_accepted[payload["temporary_channel_id"]].set_result(payload)
def on_funding_signed(self, payload): def on_funding_signed(self, payload):
sig = payload['signature'] sig = payload['signature']
@ -438,7 +438,7 @@ class Peer(PrintError):
self.network.broadcast(tx) self.network.broadcast(tx)
def on_funding_signed(self, payload): def on_funding_signed(self, payload):
self.temporary_channel_id_to_incoming_funding_signed[payload["temporary_channel_id"]].set_result(payload) self.funding_signed[payload["temporary_channel_id"]].set_result(payload)
def on_funding_locked(self, payload): def on_funding_locked(self, payload):
pass pass
@ -508,7 +508,7 @@ class Peer(PrintError):
msg = await self.read_message() msg = await self.read_message()
self.process_message(msg) self.process_message(msg)
# initialized # initialized
self.init_message_received_future.set_result(msg) self.initialized.set_result(msg)
# loop # loop
while True: while True:
self.ping_if_required() self.ping_if_required()
@ -520,7 +520,7 @@ class Peer(PrintError):
@aiosafe @aiosafe
async def channel_establishment_flow(self, wallet, config): async def channel_establishment_flow(self, wallet, config):
await self.init_message_received_future await self.initialized
keys = get_unused_keys() keys = get_unused_keys()
temp_channel_id = os.urandom(32) temp_channel_id = os.urandom(32)
funding_pubkey, funding_privkey = next(keys) funding_pubkey, funding_privkey = next(keys)
@ -542,12 +542,12 @@ class Peer(PrintError):
delayed_payment_basepoint=delayed_pubkey, delayed_payment_basepoint=delayed_pubkey,
first_per_commitment_point=next(keys)[0] first_per_commitment_point=next(keys)[0]
) )
self.temporary_channel_id_to_incoming_accept_channel[temp_channel_id] = asyncio.Future() self.channel_accepted[temp_channel_id] = asyncio.Future()
self.send_message(msg) self.send_message(msg)
try: try:
accept_channel = await self.temporary_channel_id_to_incoming_accept_channel[temp_channel_id] accept_channel = await self.channel_accepted[temp_channel_id]
finally: finally:
del self.temporary_channel_id_to_incoming_accept_channel[temp_channel_id] del self.channel_accepted[temp_channel_id]
remote_funding_pubkey = accept_channel["funding_pubkey"] remote_funding_pubkey = accept_channel["funding_pubkey"]
pubkeys = sorted([bh2u(funding_pubkey), bh2u(remote_pubkey)]) pubkeys = sorted([bh2u(funding_pubkey), bh2u(remote_pubkey)])
redeem_script = transaction.multisig_script(pubkeys, 2) redeem_script = transaction.multisig_script(pubkeys, 2)
@ -570,12 +570,12 @@ class Peer(PrintError):
r, s = sigdecode_der(sig, SECP256k1.generator.order()) r, s = sigdecode_der(sig, SECP256k1.generator.order())
sig = sigencode_string_canonize(r, s, SECP256k1.generator.order()) sig = sigencode_string_canonize(r, s, SECP256k1.generator.order())
self.print_error('canonical signature', len(sig)) self.print_error('canonical signature', len(sig))
self.temporary_channel_id_to_incoming_funding_signed[temp_channel_id] = asyncio.Future() self.funding_signed[temp_channel_id] = asyncio.Future()
self.send_message(gen_msg("funding_created", temporary_channel_id=temp_channel_id, funding_txid=bytes.fromhex(funding_tx.txid()), funding_output_index=funding_index, signature=sig)) self.send_message(gen_msg("funding_created", temporary_channel_id=temp_channel_id, funding_txid=bytes.fromhex(funding_tx.txid()), funding_output_index=funding_index, signature=sig))
try: try:
funding_signed = await self.temporary_channel_id_to_incoming_funding_signed[temp_channel_id] funding_signed = await self.funding_signed[temp_channel_id]
finally: finally:
del self.temporary_channel_id_to_incoming_funding_signed[temp_channel_id] del self.funding_signed[temp_channel_id]
# replacement for lightningCall # replacement for lightningCall

Loading…
Cancel
Save