Only open contract storage for operations that need it

pull/12/head
Bernhard Mueller 7 years ago
parent 1b56bacc91
commit 1d64166351
  1. 14
      myth

14
myth

@ -64,8 +64,6 @@ try:
except KeyError:
db_dir = None
contract_storage = get_persistent_storage(db_dir)
args = parser.parse_args()
if (args.v):
@ -155,14 +153,16 @@ elif (args.trace):
else:
print(str(i['pc']) + " " + i['op'] + ";\tSTACK: " + i['stack'])
elif (args.search):
else:
contract_storage = get_persistent_storage(db_dir)
if (args.search):
try:
contract_storage.search(args.search, searchCallback)
except SyntaxError:
exitWithError("Syntax error in search expression.")
elif (args.xrefs):
elif (args.xrefs):
try:
contract_hash = util.safe_decode(args.xrefs)
@ -175,14 +175,14 @@ elif (args.xrefs):
except KeyError:
exitWithError("Contract not found in the database.")
elif (args.init_db):
elif (args.init_db):
if args.ipc:
contract_storage.initialize(args.rpchost, args.rpcport, args.sync_all, args.ipc)
else:
contract_storage.initialize(args.rpchost, args.rpcport, args.sync_all, args.ipc)
elif (args.hash):
elif (args.hash):
print("0x" + utils.sha3(args.hash)[:4].hex())
else:
else:
parser.print_help()

Loading…
Cancel
Save