Reformat project

This commit is contained in:
2022-07-21 13:39:59 +01:00
parent 4669096fcb
commit da678617d8
57 changed files with 523 additions and 218 deletions

View File

@@ -1,11 +1,13 @@
import main
from utils.logging.log import *
from utils.logging.debug import *
from copy import deepcopy
from math import ceil
import modules.provision
from twisted.internet.threads import deferToThread
import main
import modules.provision
from utils.logging.debug import *
from utils.logging.log import *
def allRelaysActive(net):
relayNum = len(main.network[net].relays.keys())
@@ -46,7 +48,10 @@ def emptyChanAllocate(net, flist, relay, new):
if toalloc > sum(chanfree[0].values()):
correction = round(toalloc - sum(chanfree[0].values()) / chanfree[1])
# print("correction", correction)
warn("Ran out of channel spaces, provisioning additional %i relays for %s" % (correction, net))
warn(
"Ran out of channel spaces, provisioning additional %i relays for %s"
% (correction, net)
)
# newNums = modules.provision.provisionMultipleRelays(net, correction)
return False
for i in chanfree[0].keys():
@@ -99,12 +104,18 @@ def keepChannels(net, listinfo, mean, sigrelay, relay):
listinfo = minifyChans(net, listinfo)
if not listinfo:
return
if relay <= main.config["ChanKeep"]["SigSwitch"]: # we can cover all of the channels
if (
relay <= main.config["ChanKeep"]["SigSwitch"]
): # we can cover all of the channels
coverAll = True
elif relay > main.config["ChanKeep"]["SigSwitch"]: # we cannot cover all of the channels
elif (
relay > main.config["ChanKeep"]["SigSwitch"]
): # we cannot cover all of the channels
coverAll = False
if not sigrelay <= main.config["ChanKeep"]["MaxRelay"]:
error("Network %s is too big to cover: %i relays required" % (net, sigrelay))
error(
"Network %s is too big to cover: %i relays required" % (net, sigrelay)
)
return
if coverAll:
needed = relay - len(main.network[net].relays.keys())