Browse Source

Add flag --skipmerklecheck (#4957)

The --skipmerklecheck optional flag makes Electrum tolerate invalid
merkle proofs from the server. This is useful for building Electrum
servers that need a minimum amount of storage, though of course users
should only enable it if they completely trust the connected server.
3.3.3.1
chris-belcher 6 years ago
committed by ghost43
parent
commit
d5c8a0e0d0
  1. 1
      electrum/commands.py
  2. 7
      electrum/verifier.py

1
electrum/commands.py

@ -909,6 +909,7 @@ def add_network_options(parser):
parser.add_argument("-s", "--server", dest="server", default=None, help="set server host:port:protocol, where protocol is either t (tcp) or s (ssl)")
parser.add_argument("-p", "--proxy", dest="proxy", default=None, help="set proxy [type:]host[:port], where type is socks4,socks5 or http")
parser.add_argument("--noonion", action="store_true", dest="noonion", default=None, help="do not try to connect to onion servers")
parser.add_argument("--skipmerklecheck", action="store_true", dest="skipmerklecheck", default=False, help="Tolerate invalid merkle proofs from server")
def add_global_options(parser):
group = parser.add_argument_group('global options')

7
electrum/verifier.py

@ -116,8 +116,11 @@ class SPV(NetworkJobOnDefaultServer):
try:
verify_tx_is_in_block(tx_hash, merkle_branch, pos, header, tx_height)
except MerkleVerificationFailure as e:
self.print_error(str(e))
raise GracefulDisconnect(e)
if self.network.config.get("skipmerklecheck"):
self.print_error("skipping merkle proof check %s" % tx_hash)
else:
self.print_error(str(e))
raise GracefulDisconnect(e)
# we passed all the tests
self.merkle_roots[tx_hash] = header.get('merkle_root')
try: self.requested_merkle.remove(tx_hash)

Loading…
Cancel
Save