Revert "Reformat project"

This reverts commit 64e3e1160aa76d191740342ab3edc68807f890fb.
This commit is contained in:
2022-07-21 13:40:01 +01:00
parent da678617d8
commit 27cafa1def
57 changed files with 214 additions and 519 deletions

View File

@@ -1,12 +1,10 @@
import main
from utils.logging.log import *
from utils.logging.debug import *
from copy import deepcopy
from math import ceil
from twisted.internet.threads import deferToThread
import main
import modules.provision
from utils.logging.debug import *
from utils.logging.log import *
from twisted.internet.threads import deferToThread
def allRelaysActive(net):
@@ -48,10 +46,7 @@ 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():
@@ -104,18 +99,12 @@ 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())