Skip to content

Commit

Permalink
print directory node info
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamISZ committed Apr 10, 2022
1 parent 88b5e6a commit dedfe2f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/onion-message-channels.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 4 additions & 0 deletions jmdaemon/jmdaemon/onionmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1169,11 +1169,13 @@ def process_handshake(self, peerid: str, message: str,
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(
Expand All @@ -1200,6 +1202,8 @@ def process_handshake(self, peerid: str, message: str,
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
Expand Down

0 comments on commit dedfe2f

Please sign in to comment.