print directory node info

This commit is contained in:
Adam Gibson 2022-04-10 13:52:00 +01:00
parent 88b5e6a8ee
commit dedfe2ff0c
No known key found for this signature in database
GPG key ID: 141001A1AF77F20B
2 changed files with 5 additions and 1 deletions

View file

@ -153,7 +153,7 @@ who would like to help by running a directory node. You can ignore it if that do
This requires a long running bot. It should be on a server you can keep running permanently, so perhaps a VPS,
but in any case, very high uptime. For reliability it also makes sense to configure to run as a systemd service.
The currently suggested way to run a directory node is to use the script found [here](https://github.com/JoinMarket-Org/custom-scripts/blob/0eda6154265e012b907c43e2ecdacb895aa9e3ab/start-dn.py); you can place it in your `joinmarket-clientserver/scripts` directory and run it *without* arguments, but with one option flag: `--datadir=/your/chosen/datadir` (as you'll see below).
The currently suggested way to run a directory node is to use the script found [here](https://github.com/JoinMarket-Org/custom-scripts/blob/0eda6154265e012b907c43e2ecdacb895aa9e3ab/start-dn.py); you can place it in your `joinmarket-clientserver/scripts` directory and run it with the option flag: `--datadir=/your/chosen/datadir` (as you'll see below).
This slightly unobvious approach is based on the following ideas: we run a Joinmarket script, with a Joinmarket python virtualenv, so that we are able to parse messages; this means that the directory node *can* be a bot, e.g. a maker bot, but need not be - and here it is basically a "crippled" maker bot that cannot do anything. This 'crippling' is actually very useful because (a) we use the `no-blockchain` argument (it is forced in-code; you don't need to set it) so we don't need a running Bitcoin node (of whatever flavour), and (b) we don't need a wallet either.

View file

@ -1169,11 +1169,13 @@ class OnionMessageChannel(MessageChannel):
accepted = handshake_json["accepted"]
nick = handshake_json["nick"]
net = handshake_json["network"]
motd = handshake_json["motd"]
assert isinstance(proto_max, int)
assert isinstance(proto_min, int)
assert isinstance(features, dict)
assert isinstance(nick, str)
assert isinstance(net, str)
assert isinstance(motd, str)
except Exception as e:
log.warn("Invalid handshake message from: {},"
" exception: {}, message: {},ignoring".format(
@ -1200,6 +1202,8 @@ class OnionMessageChannel(MessageChannel):
return
# We received a valid, accepting dn-handshake. Update the peer.
peer.update_status(PEER_STATUS_HANDSHAKED)
# Show the info for the directory to the user, with emphasis:
self.info_callback("\n\n" + motd + "\n\n")
peer.set_nick(nick)
else:
# it means, we are receiving an initial handshake