electrum-personal-server

Maximally lightweight electrum server for a single user
git clone https://git.parazyd.org/electrum-personal-server
Log | Files | Refs | README

commit 67fdb35c8b5b3291e4a36cbb016cce5b2aa2d865
parent 2be15670383b738770ef42b9a0d8f84a6341660e
Author: chris-belcher <chris-belcher@users.noreply.github.com>
Date:   Tue, 13 Nov 2018 16:59:36 +0000

Block broadcasting when blocksonly enabled

Broadcasting while blocksonly is enabled is bad for privacy because it
reveals to your peers that your transaction certainly came from your IP
address.

Diffstat:
Melectrumpersonalserver/server/common.py | 12+++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/electrumpersonalserver/server/common.py b/electrumpersonalserver/server/common.py @@ -225,11 +225,13 @@ def handle_query(sock, line, rpc, txmonitor): headers_hex, n = get_block_headers_hex(rpc, start_height, count) send_response(sock, query, headers_hex) elif method == "blockchain.transaction.broadcast": - try: - result = rpc.call("sendrawtransaction", [query["params"][0]]) - except JsonRpcError as e: - result = str(e) - logger.debug("tx broadcast result = " + str(result)) + if not rpc.call("getnetworkinfo", [])["localrelay"]: + result = "Broadcast disabled when using blocksonly" + else: + try: + result = rpc.call("sendrawtransaction", [query["params"][0]]) + except JsonRpcError as e: + result = str(e) send_response(sock, query, result) elif method == "mempool.get_fee_histogram": mempool = rpc.call("getrawmempool", [True])