tshow number of tx signatures in gui - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 37148b72d48383c3fb8b6a8ee17c3398e3675481 DIR parent b28a0bcdd4d6489001b72c177c6b8204a7d6c9a6 HTML Author: ThomasV <thomasv@gitorious> Date: Sun, 22 Jun 2014 12:07:41 +0200 show number of tx signatures in gui Diffstat: M gui/qt/transaction_dialog.py | 9 +++++---- M lib/transaction.py | 21 ++++++++++++--------- 2 files changed, 17 insertions(+), 13 deletions(-) --- DIR diff --git a/gui/qt/transaction_dialog.py b/gui/qt/transaction_dialog.py t@@ -132,7 +132,7 @@ class TxDialog(QDialog): is_relevant, is_mine, v, fee = self.wallet.get_tx_value(self.tx) if self.tx.is_complete(): - status = _("Status: Signed") + status = _("Signed") self.sign_button.hide() tx_hash = self.tx.hash() t@@ -142,14 +142,15 @@ class TxDialog(QDialog): time_str = datetime.datetime.fromtimestamp(timestamp).isoformat(' ')[:-3] else: time_str = 'pending' - status = _("Status: %d confirmations")%conf + status = _("%d confirmations")%conf self.broadcast_button.hide() else: time_str = None conf = 0 self.broadcast_button.show() 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 if not self.wallet.is_watching_only(): self.sign_button.show() t@@ -159,7 +160,7 @@ class TxDialog(QDialog): tx_hash = 'unknown' self.tx_hash_e.setText(tx_hash) - self.status_label.setText(status) + self.status_label.setText(_('Status:') + ' ' + status) if time_str is not None: self.date_label.setText(_("Date: %s")%time_str) DIR diff --git a/lib/transaction.py b/lib/transaction.py t@@ -599,17 +599,20 @@ class Transaction: self.raw = self.serialize( self.inputs, self.outputs ) - def is_complete(self): - for i, txin in enumerate(self.inputs): - pubkeys = txin['pubkeys'] - signatures = txin.get("signatures",{}) - if len(signatures) == txin['num_sig']: - continue - else: - return False - return True + def signature_count(self): + r = 0 + s = 0 + for txin in self.inputs: + signatures = txin.get("signatures",[]) + s += len(signatures) + r += txin['num_sig'] + return s, r + def is_complete(self): + s, r = self.signature_count() + return r == s + def sign(self, keypairs): print_error("tx.sign(), keypairs:", keypairs)