Commit 1cc10e2f authored by inso's avatar inso

Remove blocksRot from parameters

parent 3ed1d3e7
......@@ -222,16 +222,13 @@ PARAMETERS_SCHEMA = {
"dtDiffEval": {
"type": "number"
},
"blocksRot": {
"type": "number"
},
"percentRot": {
"type": "number"
},
},
"required": ["currency", "c", "dt", "ud0","sigPeriod", "sigValidity", "sigQty", "xpercent", "sigStock",
"sigWindow", "msValidity","stepMax", "medianTimeBlocks",
"avgGenTime", "dtDiffEval", "blocksRot", "percentRot"]
"avgGenTime", "dtDiffEval", "percentRot"]
}
......
......@@ -142,6 +142,8 @@ The class Block handles Block documents.
re_previousissuer = re.compile("PreviousIssuer: ({pubkey_regex})\n".format(pubkey_regex=pubkey_regex))
re_parameters = re.compile("Parameters: ([0-9]+\.[0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):\
([0-9]+):([0-9]+):([0-9]+\.[0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+\.[0-9]+)\n")
re_parameters_v10 = re.compile("Parameters: ([0-9]+\.[0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):\
([0-9]+):([0-9]+):([0-9]+\.[0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+\.[0-9]+)\n")
re_memberscount = re.compile("MembersCount: ([0-9]+)\n")
re_identities = re.compile("Identities:\n")
re_joiners = re.compile("Joiners:\n")
......@@ -323,7 +325,10 @@ The class Block handles Block documents.
parameters = None
if number == 0:
try:
parameters = Block.re_parameters.match(lines[n]).groups()
if version >= 10:
parameters = Block.re_parameters_v10.match(lines[n]).groups()
else:
parameters = Block.re_parameters.match(lines[n]).groups()
n += 1
except AttributeError:
raise MalformedDocumentError("Parameters")
......@@ -527,3 +532,18 @@ Nonce: {nonce}
signed = self.raw()[-2:]
signing = base64.b64encode(key.signature(bytes(signed, 'ascii')))
self.signatures = [signing.decode("ascii")]
def __eq__(self, other):
return self.blockUID == other.blockUID
def __lt__(self, other):
return self.blockUID < other.blockUID
def __gt__(self, other):
return self.blockUID > other.blockUID
def __le__(self, other):
return self.blockUID <= other.blockUID
def __ge__(self, other):
return self.blockUID >= other.blockUID
......@@ -235,7 +235,7 @@ class SecuredBMAEndpoint(BMAEndpoint):
IPv6=(" {0}".format(self.ipv6) if self.ipv6 else ""),
PORT=(" {0}".format(self.port) if self.port else ""))
def conn_handler(self, session=None):
def conn_handler(self, session=None, proxy=None):
"""
Return connection handler instance for the endpoint
......@@ -243,8 +243,8 @@ class SecuredBMAEndpoint(BMAEndpoint):
:rtype: ConnectionHandler
"""
if self.server:
return ConnectionHandler("https", "wss", self.server, self.port, session)
return ConnectionHandler("https", "wss", self.server, self.port, proxy, session)
elif self.ipv4:
return ConnectionHandler("https", "wss", self.ipv4, self.port, session)
return ConnectionHandler("https", "wss", self.ipv4, self.port, proxy, session)
else:
return ConnectionHandler("https", "wss", "[{0}]".format(self.ipv6), self.port, session)
return ConnectionHandler("https", "wss", "[{0}]".format(self.ipv6), self.port, proxy, session)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment