Skip to content
Snippets Groups Projects
Commit eb105273 authored by vincent's avatar vincent
Browse files

Add versbose to BTC symbolic interpreter

parent 22cdfce6
No related branches found
No related tags found
No related merge requests found
......@@ -51,15 +51,20 @@ def __find_unlocking_script_timed(hex_script, return_dict, verbose):
try:
btc_parser = BitcoinParser()
tokens = btc_parser.tokenize_code(hex_script)
if verbose:
print(tokens)
program = btc_parser.build_control_flow_graph(tokens)
if verbose:
print(program)
machine = BTCMachine(FullySymbolicRAM, BTC_VECTOR_SIZE, stack_count=2)
symbolic_executer = SymbolicExecuter()
final_machine = symbolic_executer.execute(program, machine)
top_elt = final_machine.pop_from_stack()
if verbose:
print(top_elt.val)
s = Solver()
s.add(top_elt.val != 0)
......@@ -109,4 +114,4 @@ def find_unlocking_script(hex_script: str, timeout=None, verbose=False):
if p1.exitcode is None:
return "", Satifiability.z3_to_enum(unknown)
else:
return return_dict["model"], return_dict["satisfiability"]
return return_dict["model"], return_dict["satisfiability"]#, return_dict["tokens"], return_dict["program"]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment