Fix various bugs and off by one with provisioning

This commit is contained in:
Mark Veidemanis 2020-10-31 23:55:11 +00:00
parent b0eaa7fd47
commit 49fd03304d
1 changed files with 4 additions and 1 deletions

View File

@ -41,7 +41,10 @@ def emptyChanAllocate(net, flist, relay, new):
allocated = {} allocated = {}
toalloc = len(flist) toalloc = len(flist)
if toalloc > sum(chanfree[0].values()): if toalloc > sum(chanfree[0].values()):
error("Too many channels to allocate for %s - channels joined since initial query, wait a while" % net) 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))
#newNums = modules.provision.provisionMultipleRelays(net, correction)
return False return False
for i in chanfree[0].keys(): for i in chanfree[0].keys():
for x in range(chanfree[0][i]): for x in range(chanfree[0][i]):