From 5df35156f36404929daaa31b20990c68910c3220 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Mon, 12 Sep 2022 01:12:06 +0300 Subject: [PATCH] update readme --- README.md | 4 +++- wallet/wallet.py | 10 ++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 9e86e58..4f8cae2 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,9 @@ **The author is NOT a cryptographer and has not tested the libraries used or the code nor has anyone reviewed the work. This means it's very likely a fatal flaw somewhere. This is meant only as educational and is not production ready.** -Ecash implementation based on David Wagner's variant of Chaumian blinding. Token logic based on [minicash](https://github.com/phyro/minicash) ([description](https://gist.github.com/phyro/935badc682057f418842c72961cf096c)) which implements a [Blind Diffie-Hellman Key Exchange](https://cypherpunks.venona.com/date/1996/03/msg01848.html) scheme written down by Ruben Somsen [here](https://gist.github.com/RubenSomsen/be7a4760dd4596d06963d67baf140406). +Ecash implementation based on David Wagner's variant of Chaumian blinding. Token logic based on [minicash](https://github.com/phyro/minicash) ([description](https://gist.github.com/phyro/935badc682057f418842c72961cf096c)) which implements a [Blind Diffie-Hellman Key Exchange](https://cypherpunks.venona.com/date/1996/03/msg01848.html) scheme written down by Ruben Somsen [here](https://gist.github.com/RubenSomsen/be7a4760dd4596d06963d67baf140406). The database mechanics and the Lightning backend is inspired by [LNbits](https://github.com/lnbits/lnbits-legend). + +Big thanks to [phyro](https://github.com/phyro) for their work and further discussions and improvements. ## Install diff --git a/wallet/wallet.py b/wallet/wallet.py index 1ef1445..4c9aa48 100644 --- a/wallet/wallet.py +++ b/wallet/wallet.py @@ -63,8 +63,7 @@ class LedgerAPI: json={"x": str(B_.x), "y": str(B_.y)}, ).json() if "error" in promises: - print("Error: {}".format(promises["error"])) - return [] + raise Exception("Error: {}".format(promises["error"])) return self._construct_proofs(promises, [(r, secret)]) def split(self, proofs, amount): @@ -94,8 +93,7 @@ class LedgerAPI: json={"proofs": proofs, "amount": amount, "output_data": output_data}, ).json() if "error" in promises: - print("Error: {}".format(promises["error"])) - return [], [] + raise Exception("Error: {}".format(promises["error"])) # Obtain proofs from promises fst_proofs = self._construct_proofs( @@ -129,7 +127,7 @@ class Wallet(LedgerAPI): for amount in split: proofs = super().mint(amount) if proofs == []: - return [] + raise Exception("received no proofs") new_proofs += proofs await self._store_proofs(proofs) self.proofs += new_proofs @@ -141,7 +139,7 @@ class Wallet(LedgerAPI): async def split(self, proofs, amount): fst_proofs, snd_proofs = super().split(proofs, amount) if len(fst_proofs) == 0 and len(snd_proofs) == 0: - return [], [] + raise Exception("received no splits") used_secrets = [p["secret"] for p in proofs] self.proofs = list( filter(lambda p: p["secret"] not in used_secrets, self.proofs)