예제 #1
0
 def electrum_tx_to_txtype(self, tx: Optional[Transaction]):
     t = TransactionType()
     if tx is None:
         # probably for segwit input and we don't need this prev txn
         return t
     tx.deserialize()
     t.version = tx.version
     t.timestamp = tx.time
     t.lock_time = tx.locktime
     t.inputs = self.tx_inputs(tx)
     t.bin_outputs = [
         TxOutputBinType(amount=o.value, script_pubkey=o.scriptpubkey)
         for o in tx.outputs()
     ]
     return t
예제 #2
0
 def electrum_tx_to_txtype(self, tx, xpub_path):
     t = TransactionType()
     if tx is None:
         # probably for segwit input and we don't need this prev txn
         return t
     d = deserialize(tx.raw)
     t.version = d['version']
     t.timestamp = d['time']
     t.lock_time = d['lockTime']
     t.inputs = self.tx_inputs(tx, xpub_path)
     t.bin_outputs = [
         TxOutputBinType(amount=vout['value'],
                         script_pubkey=bfh(vout['scriptPubKey']))
         for vout in d['outputs']
     ]
     return t