Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print directory node info #1231

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should limit allowed character set here, for example, don't allow ASCII control characters.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes good point. Also there is the question of size. A slight concern I have is, it would be very natural to add e.g. gpg signatures here, but they would represent a big chunk of spam. I guess best practice will be, put a url here where the signature can be found.

peer.set_nick(nick)
else:
# it means, we are receiving an initial handshake
Expand Down