Closed piegamesde closed 2 years ago
Hmm, the python version installed from ubuntu 20.04 still sets them for direct-tcp-v1:
{
"abilities-v1": [
{
"type": "direct-tcp-v1"
},
{
"type": "relay-v1"
}
],
"hints-v1": [
{
"hostname": "192.168.11.15",
"port": 40385,
"priority": 0,
"type": "direct-tcp-v1",
"hints": null
},
{
"hostname": "10.8.73.1",
"port": 40385,
"priority": 0,
"type": "direct-tcp-v1",
"hints": null
},
{
"hostname": "10.0.3.1",
"port": 40385,
"priority": 0,
"type": "direct-tcp-v1",
"hints": null
},
{
"hostname": "172.17.0.1",
"port": 40385,
"priority": 0,
"type": "direct-tcp-v1",
"hints": null
},
{
"hostname": "",
"port": 0,
"priority": 0,
"type": "relay-v1",
"hints": [
{
"hostname": "magic-wormhole-transit.debian.net",
"port": 4001,
"priority": 2,
"type": "direct-tcp-v1"
}
]
}
]
}
Is this not the code in question? https://github.com/magic-wormhole/magic-wormhole/blob/master/src/wormhole/_hints.py#L124-L129
Is this not the code in question?
No, the issue is with relay hints. It is directly below the code that you linked, and there you can see how the hints
list is used.
In wormhole-william the fields are present on transitHintsV1
because they are used by direct-tcp-v1
.
Oh wow, I hadn't noticed that. Is there a better pattern to deal with this kind of data than simply putting all fields onto one struct? Because I'm about to run in to the same problem but one layer down (on transitHintsV1Hint
) for the implementation of relay-v2
hints.
https://github.com/psanford/wormhole-william/blob/1a5ce30d226ecc7d7b5512488f71a36a11c56265/wormhole/wormhole.go#L270-L283
The
hostname
,port
andpriority
fields ontransitHintsV1
are wrong* and should be removed. All relays should be encoded usingtransitHintsV1Hint
instead.* respective to the current Python implementation as source of truth. It is totally possible that this once was an acceptable serialization format some time ago.