Exemplo n.º 1
0
    def on_receive(self):
        if self.wallet.use_encryption:
            password = self.win.password_dialog('An encrypted transaction was retrieved from cosigning pool.\nPlease enter your password to decrypt it.')
            if not password:
                return
        else:
            password = None
            if not self.win.question(_("An encrypted transaction was retrieved from cosigning pool.\nDo you want to open it now?")):
                return

        message = self.listener.message
        key = self.listener.keyname
        xprv = self.wallet.get_master_private_key(key, password)
        if not xprv:
            return
        try:
            k = bitcoin.deserialize_xkey(xprv)[-1].encode('hex')
            EC = bitcoin.EC_KEY(k.decode('hex'))
            message = EC.decrypt_message(message)
        except Exception as e:
            traceback.print_exc(file=sys.stdout)
            self.win.show_message(str(e))
            return

        self.listener.clear()
        tx = transaction.Transaction.deserialize(message)
        self.win.show_transaction(tx)
Exemplo n.º 2
0
 def load_wallet(self, wallet):
     self.wallet = wallet
     if not self.is_available():
         return
     mpk = self.wallet.get_master_public_keys()
     self.cosigner_list = []
     for key, xpub in mpk.items():
         keyname = key + '/' # fixme
         K = bitcoin.deserialize_xkey(xpub)[-1].encode('hex')
         _hash = bitcoin.Hash(K).encode('hex')
         if self.wallet.master_private_keys.get(keyname):
             self.listener.set_key(keyname, _hash)
         else:
             self.cosigner_list.append((xpub, K, _hash))