-
Notifications
You must be signed in to change notification settings - Fork 110
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
Broadcast transactions through tor #124
Conversation
Thanks for the PR, good job. Here's some thoughts, including some inline comments.
|
I believe I fixed this with with a
I tested this already and it works. ipv6 does not work with this code, however. Will update with all your other suggestions. Thanks. |
I just realized that since Electrum uses segwit we need to set NODE_WITNESS services ourselves and only connect to nodes with NODE_WITNESS services. So we should filter the results of See also: https://github.com/bitcoin/bips/blob/master/bip-0144.mediawiki#handshake Maybe add another constant at the top of the file Also, I'm in two minds about whether to really set the user agent to |
|
I think I addressed everything with the latest commit. I can squash once you're happy with it. |
Note that it takes a while to broadcast on testnet sometimes, since there aren't many listening nodes. |
Thanks. I've added some comments. How long does it normally take to broadcast? It's expected that it will be a bit slower, but ideally it will be as fast as possible. We could try raising |
When I hardcoded an onion address it worked almost instantly, since it doesn't have to go through an exit node. Too bad we can't tell listening nodes from |
Updated with your feedback. |
Thanks for sticking with it. I think it looks good, I'll try testing it soon. |
As soon as a transaction is uploaded it is propagated to the local node within a few seconds at most, so the feedback happens for the user like that. However, as soon as the server is done spawning all the upload threads the user gets a |
I tested on mainnet with your suggestion of not actually broadcasting it, and it works much better than testnet. Usually at least 1 of the first 8 tries finds a listening node. |
Could you squish this into one commit |
c47f046
to
30de99a
Compare
Done |
I copied your code at https://github.com/JoinMarket-Org/joinmarket/blob/master/joinmarket/peertopeer.py almost verbatim and translated to Python3, as well as https://github.com/JoinMarket-Org/joinmarket/blob/master/joinmarket/socks.py.
It takes a new
tor
broadcast_method
in the config, and you can optionally specifytor_host
andtor_port
otherwise falls back tolocalhost:9050
. The p2p network messages are different depending on network, so not sure if it'd be worth putting that in the config. Currently hardcoded mainnet and 4 attempts at connections.Let me know what you think.
Resolves #52.