#NEWLINE# def get_opcode( script , pc ) : #NEWLINE# #INDENT# 'Step through the script, returning a tuple with the next opcode, the next\n    piece of data (if the opcode represents data), and the new PC.' #NEWLINE# opcode = ord ( script [ pc : ( pc + 1 ) ] ) #NEWLINE# pc += 1 #NEWLINE# data = b'' #NEWLINE# if ( opcode <= OPCODE_TO_INT [ 'OP_PUSHDATA4' ] ) : #NEWLINE# #INDENT# if ( opcode < OPCODE_TO_INT [ 'OP_PUSHDATA1' ] ) : #NEWLINE# #INDENT# size = opcode #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( opcode == OPCODE_TO_INT [ 'OP_PUSHDATA1' ] ) : #NEWLINE# #INDENT# size = bytes_to_int ( script [ pc : ( pc + 1 ) ] ) #NEWLINE# pc += 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( opcode == OPCODE_TO_INT [ 'OP_PUSHDATA2' ] ) : #NEWLINE# #INDENT# size = bytes_to_int ( script [ pc : ( pc + 2 ) ] ) #NEWLINE# pc += 2 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( opcode == OPCODE_TO_INT [ 'OP_PUSHDATA4' ] ) : #NEWLINE# #INDENT# size = bytes_to_int ( script [ data : ( pc + 4 ) ] ) #NEWLINE# pc += 4 #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# data = script [ pc : ( pc + size ) ] #NEWLINE# pc += size #NEWLINE# #UNINDENT# return ( opcode , data , pc )