Exemple #1
0
    def read_slave(self):
        if not os.path.isfile(self.slave_dat_filename):
            return
        try:
            with open(self.slave_dat_filename, "rb") as infile:
                w = qrl_pb2.Wallet()
                w.ParseFromString(bytes(infile.read()))
                return AddressSerialized(w.address, w.mnemonic, w.xmss_index)

        except Exception as e:
            logger.warning("It was not possible to open the wallet: %s", e)
Exemple #2
0
    def GetWallet(self, request: qrl_pb2.GetWalletReq,
                  context) -> qrl_pb2.GetWalletResp:
        answer = qrl_pb2.GetWalletResp()

        addr_bundle = self.qrlnode.get_address_bundle(request.address)
        if addr_bundle is not None:
            answer.wallet.CopyFrom(
                qrl_pb2.Wallet(address=addr_bundle.address,
                               mnemonic=addr_bundle.xmss.get_mnemonic(),
                               xmss_index=addr_bundle.xmss.get_index()))

        return answer
Exemple #3
0
    def save_wallet(self):
        logger.debug('Syncing wallet file')

        wallet_store = qrl_pb2.WalletStore()
        wallets = []
        for a in self.address_bundle:
            wallets.append(qrl_pb2.Wallet(address=a.address,
                                          mnemonic=a.xmss.get_mnemonic(),
                                          xmss_index=a.xmss.get_index()))
        wallet_store.wallets.extend(wallets)

        with open(self.wallet_dat_filename, "wb") as outfile:
            outfile.write(wallet_store.SerializeToString())
Exemple #4
0
 def save_slave(self, slave):
     with open(self.slave_dat_filename, "wb") as outfile:
         w = qrl_pb2.Wallet(address=slave.get_address(),
                            mnemonic=slave.get_mnemonic(),
                            xmss_index=slave.get_index())
         outfile.write(w.SerializeToString())