show number of tx signatures in gui

This commit is contained in:
ThomasV 2014-06-22 12:07:41 +02:00
parent b28a0bcdd4
commit 37148b72d4
2 changed files with 17 additions and 13 deletions

View File

@ -132,7 +132,7 @@ class TxDialog(QDialog):
is_relevant, is_mine, v, fee = self.wallet.get_tx_value(self.tx) is_relevant, is_mine, v, fee = self.wallet.get_tx_value(self.tx)
if self.tx.is_complete(): if self.tx.is_complete():
status = _("Status: Signed") status = _("Signed")
self.sign_button.hide() self.sign_button.hide()
tx_hash = self.tx.hash() tx_hash = self.tx.hash()
@ -142,14 +142,15 @@ class TxDialog(QDialog):
time_str = datetime.datetime.fromtimestamp(timestamp).isoformat(' ')[:-3] time_str = datetime.datetime.fromtimestamp(timestamp).isoformat(' ')[:-3]
else: else:
time_str = 'pending' time_str = 'pending'
status = _("Status: %d confirmations")%conf status = _("%d confirmations")%conf
self.broadcast_button.hide() self.broadcast_button.hide()
else: else:
time_str = None time_str = None
conf = 0 conf = 0
self.broadcast_button.show() self.broadcast_button.show()
else: else:
status = _("Status: Unsigned") s, r = self.tx.signature_count()
status = _("Unsigned") if s == 0 else _('Partially signed (%d/%d)'%(s,r))
time_str = None time_str = None
if not self.wallet.is_watching_only(): if not self.wallet.is_watching_only():
self.sign_button.show() self.sign_button.show()
@ -159,7 +160,7 @@ class TxDialog(QDialog):
tx_hash = 'unknown' tx_hash = 'unknown'
self.tx_hash_e.setText(tx_hash) self.tx_hash_e.setText(tx_hash)
self.status_label.setText(status) self.status_label.setText(_('Status:') + ' ' + status)
if time_str is not None: if time_str is not None:
self.date_label.setText(_("Date: %s")%time_str) self.date_label.setText(_("Date: %s")%time_str)

View File

@ -599,17 +599,20 @@ class Transaction:
self.raw = self.serialize( self.inputs, self.outputs ) self.raw = self.serialize( self.inputs, self.outputs )
def is_complete(self): def signature_count(self):
for i, txin in enumerate(self.inputs): r = 0
pubkeys = txin['pubkeys'] s = 0
signatures = txin.get("signatures",{}) for txin in self.inputs:
if len(signatures) == txin['num_sig']: signatures = txin.get("signatures",[])
continue s += len(signatures)
else: r += txin['num_sig']
return False return s, r
return True
def is_complete(self):
s, r = self.signature_count()
return r == s
def sign(self, keypairs): def sign(self, keypairs):
print_error("tx.sign(), keypairs:", keypairs) print_error("tx.sign(), keypairs:", keypairs)