diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-04-29 20:08:47 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-09-17 11:38:21 +0000 |
commit | 8e077a5fc028a8926d7679fd403e4692b222ad96 (patch) | |
tree | 1fdc86e6b3806f7bb20d6c527599e409c064d664 /tests/functional_tests/proofs.py | |
parent | functional_tests: add test for mining via wallet (diff) | |
download | monero-8e077a5fc028a8926d7679fd403e4692b222ad96.tar.xz |
functional_tests: add spend proof tests
Diffstat (limited to '')
-rwxr-xr-x | tests/functional_tests/proofs.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/functional_tests/proofs.py b/tests/functional_tests/proofs.py index 243929dc3..f443ba795 100755 --- a/tests/functional_tests/proofs.py +++ b/tests/functional_tests/proofs.py @@ -44,6 +44,7 @@ class ProofsTest(): txid, tx_key, amount = self.transfer() self.check_tx_key(txid, tx_key, amount) self.check_tx_proof(txid, amount) + self.check_spend_proof(txid) self.check_reserve_proof() def reset(self): @@ -217,6 +218,40 @@ class ProofsTest(): except: ok = True assert ok or not res.good + def check_spend_proof(self, txid): + daemon = Daemon() + + print('Checking spend proof') + + self.wallet[0].refresh() + self.wallet[1].refresh() + + res = self.wallet[0].get_spend_proof(txid, message = 'foo') + assert len(res.signature) > 0 + signature = res.signature + res = self.wallet[1].check_spend_proof(txid, message = 'foo', signature = signature) + assert res.good + + res = self.wallet[0].get_spend_proof(txid, message = 'foobar') + assert len(res.signature) > 0 + signature2 = res.signature + res = self.wallet[1].check_spend_proof(txid, message = 'foobar', signature = signature2) + assert res.good + + ok = False + try: res = self.wallet[1].check_spend_proof('0' * 64, message = 'foo', signature = signature) + except: ok = True + assert ok or not res.good + + ok = False + try: res = self.wallet[1].check_spend_proof(txid, message = 'bar', signature = signature) + except: ok = True + assert ok or not res.good + + ok = False + try: res = self.wallet[1].check_spend_proof(txid, message = 'foo', signature = signature2) + except: ok = True + assert ok or not res.good def check_reserve_proof(self): daemon = Daemon() |