Browse Source

return txid for unsigned segwit transactions

283
ThomasV 8 years ago
parent
commit
aed2b04dbd
  1. 3
      lib/transaction.py
  2. 3
      lib/wallet.py

3
lib/transaction.py

@ -722,6 +722,9 @@ class Transaction:
return self.txid() return self.txid()
def txid(self): def txid(self):
all_segwit = all(self.is_segwit_input(x) for x in self.inputs())
if not all_segwit and not self.is_complete():
return None
ser = self.serialize(witness=False) ser = self.serialize(witness=False)
return Hash(ser.decode('hex'))[::-1].encode('hex') return Hash(ser.decode('hex'))[::-1].encode('hex')

3
lib/wallet.py

@ -436,8 +436,8 @@ class Abstract_Wallet(PrintError):
can_bump = False can_bump = False
label = '' label = ''
height = conf = timestamp = None height = conf = timestamp = None
tx_hash = tx.txid()
if tx.is_complete(): if tx.is_complete():
tx_hash = tx.txid()
if tx_hash in self.transactions.keys(): if tx_hash in self.transactions.keys():
label = self.get_label(tx_hash) label = self.get_label(tx_hash)
height, conf, timestamp = self.get_tx_height(tx_hash) height, conf, timestamp = self.get_tx_height(tx_hash)
@ -461,7 +461,6 @@ class Abstract_Wallet(PrintError):
else: else:
s, r = tx.signature_count() s, r = tx.signature_count()
status = _("Unsigned") if s == 0 else _('Partially signed') + ' (%d/%d)'%(s,r) status = _("Unsigned") if s == 0 else _('Partially signed') + ' (%d/%d)'%(s,r)
tx_hash = None
if is_relevant: if is_relevant:
if is_mine: if is_mine:

Loading…
Cancel
Save