lnbase: formatting, remove imports

This commit is contained in:
Janus 2018-05-14 16:03:22 +02:00
parent 39df2a50b7
commit 3d3fe9976c

View File

@ -9,7 +9,6 @@ from ecdsa import VerifyingKey
from ecdsa.curves import SECP256k1 from ecdsa.curves import SECP256k1
import queue import queue
import traceback import traceback
import itertools
import json import json
from collections import OrderedDict, defaultdict from collections import OrderedDict, defaultdict
import asyncio import asyncio
@ -105,7 +104,7 @@ def make_handler(k, v):
pos = 0 pos = 0
for fieldname in v["payload"]: for fieldname in v["payload"]:
poslenMap = v["payload"][fieldname] poslenMap = v["payload"][fieldname]
if "feature" in poslenMap and pos==len(data): if "feature" in poslenMap and pos == len(data):
continue continue
#print(poslenMap["position"], ma) #print(poslenMap["position"], ma)
assert pos == calcexp(poslenMap["position"], ma) assert pos == calcexp(poslenMap["position"], ma)
@ -505,13 +504,13 @@ def make_commitment(ctn, local_funding_pubkey, remote_funding_pubkey, remote_pay
c_inputs = [{ c_inputs = [{
'type': 'p2wsh', 'type': 'p2wsh',
'x_pubkeys': pubkeys, 'x_pubkeys': pubkeys,
'signatures':[None, None], 'signatures': [None, None],
'num_sig': 2, 'num_sig': 2,
'prevout_n': funding_pos, 'prevout_n': funding_pos,
'prevout_hash': funding_txid, 'prevout_hash': funding_txid,
'value': funding_sat, 'value': funding_sat,
'coinbase': False, 'coinbase': False,
'sequence':sequence 'sequence': sequence
}] }]
# commitment tx outputs # commitment tx outputs
local_script = bytes([opcodes.OP_IF]) + bfh(push_script(bh2u(revocation_pubkey))) + bytes([opcodes.OP_ELSE]) + add_number_to_script(to_self_delay) \ local_script = bytes([opcodes.OP_IF]) + bfh(push_script(bh2u(revocation_pubkey))) + bytes([opcodes.OP_ELSE]) + add_number_to_script(to_self_delay) \
@ -730,7 +729,7 @@ class Peer(PrintError):
if atype == 0: if atype == 0:
pass pass
elif atype == 1: elif atype == 1:
ipv4_addr = '.'.join(map(lambda x: '%d'%x, read(4))) ipv4_addr = '.'.join(map(lambda x: '%d' % x, read(4)))
port = int.from_bytes(read(2), 'big') port = int.from_bytes(read(2), 'big')
x = ipv4_addr, port, binascii.hexlify(pubkey) x = ipv4_addr, port, binascii.hexlify(pubkey)
addresses.append((ipv4_addr, port)) addresses.append((ipv4_addr, port))