|
@@ -205,8 +205,8 @@ class SinglePassCreatedHandler:
|
|
|
dirauth.SNIP.verify(snip, self.channelmgr.consensus,
|
|
|
network.thenetwork.dirauthkeys()[0],
|
|
|
self.channelmgr.perfstats)
|
|
|
- # TODO: compute the index, check the VRF, ensure the
|
|
|
- # SNIP is the correct one
|
|
|
+ # Compute the index, check the VRF, ensure the SNIP is
|
|
|
+ # the correct one
|
|
|
pathsel_rand, next_blindkey = relay.Sphinx.client(
|
|
|
self.client_key, blinding_keys,
|
|
|
onionkey, b'pathsel',
|
|
@@ -214,10 +214,14 @@ class SinglePassCreatedHandler:
|
|
|
if nextlayer is not None:
|
|
|
blinding_keys.append(next_blindkey)
|
|
|
|
|
|
- index = int.from_bytes(relay.VRF.check_output(pathselkey,
|
|
|
+ try:
|
|
|
+ index = int.from_bytes(relay.VRF.check_output(pathselkey,
|
|
|
pathsel_rand, vrfout,
|
|
|
self.channelmgr.perfstats)[:4],
|
|
|
'big', signed=False)
|
|
|
+ except ValueError as e:
|
|
|
+ circhandler.close()
|
|
|
+ raise ValueError(str(e.args) + str(lasthopd))
|
|
|
|
|
|
indexrange = snip.snipdict["range"]
|
|
|
if index < indexrange[0] or index >= indexrange[1]:
|