#NEWLINE# def _find_payment( self , msg , txid , txtype ) : #NEWLINE# #INDENT# ' search ix/tx for transaction matching current address ' #NEWLINE# addr = None #NEWLINE# value = 0 #NEWLINE# refund = 0 #NEWLINE# for vout in msg . tx . vout : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# addr = str ( P2PKHBitcoinAddress . from_scriptPubKey ( vout . scriptPubKey ) ) #NEWLINE# #UNINDENT# except CBitcoinAddressError : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( addr == self . current_address ) : #NEWLINE# #INDENT# value = int ( vout . nValue ) #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# if ( addr and value ) : #NEWLINE# #INDENT# if ( txtype < self . vend . cost ) : #NEWLINE# #INDENT# refund = AmountToJSON ( value ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( value > self . vend . cost ) : #NEWLINE# #INDENT# refund = AmountToJSON ( ( value - self . vend . cost ) ) #NEWLINE# #UNINDENT# #UNINDENT# if ( txid not in self . mempool ) : #NEWLINE# #INDENT# self . mempool [ txid ] = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# self . mempool [ txid ] [ txtype ] = True #NEWLINE# if ( txtype == 'tx' ) : #NEWLINE# #INDENT# tx = self . mempool [ txid ] [ 'processed' ] #NEWLINE# tx [ 'refund' ] = AmountToJSON ( tx [ 'value' ] ) #NEWLINE# #UNINDENT# self . mempool [ txid ] [ 'processed' ] = { #NEWLINE# #INDENT# 'addr' : addr , #NEWLINE# 'value' : value , #NEWLINE# 'refund' : refund , #NEWLINE# 'sale' : ( ( ( value >= self . vend . cost ) and True ) or False ) , #NEWLINE# #UNINDENT# } #NEWLINE# self . vend . get_next_address ( increment = True ) #NEWLINE# return True