aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-10-31 14:09:19 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-12-31 08:44:36 +0000
commitd64e5aa71936d86f91d3f45a9da0468f97078409 (patch)
tree1376f2390b9c971f95b9e188d38f899af6a6e84f /tests
parentMerge pull request #6044 (diff)
downloadmonero-d64e5aa71936d86f91d3f45a9da0468f97078409.tar.xz
wallet: allow message sign/verify for subaddresses
Diffstat (limited to 'tests')
-rwxr-xr-xtests/functional_tests/sign_message.py31
1 files changed, 23 insertions, 8 deletions
diff --git a/tests/functional_tests/sign_message.py b/tests/functional_tests/sign_message.py
index de8f0cee2..9dd70f8bc 100755
--- a/tests/functional_tests/sign_message.py
+++ b/tests/functional_tests/sign_message.py
@@ -43,7 +43,8 @@ from framework.wallet import Wallet
class MessageSigningTest():
def run_test(self):
self.create()
- self.check_signing()
+ self.check_signing(False)
+ self.check_signing(True)
def create(self):
print('Creating wallets')
@@ -65,20 +66,34 @@ class MessageSigningTest():
assert res.address == self.address[i]
assert res.seed == seeds[i]
- def check_signing(self):
- print('Signing/verifing messages')
+ def check_signing(self, subaddress):
+ print('Signing/verifing messages with ' + ('subaddress' if subaddress else 'standard address'))
messages = ['foo', '']
+ if subaddress:
+ address = []
+ for i in range(2):
+ res = self.wallet[i].create_account()
+ if i == 0:
+ account_index = res.account_index
+ res = self.wallet[i].create_address(account_index = account_index)
+ if i == 0:
+ address_index = res.address_index
+ address.append(res.address)
+ else:
+ address = [self.address[0], self.address[1]]
+ account_index = 0
+ address_index = 0
for message in messages:
- res = self.wallet[0].sign(message)
+ res = self.wallet[0].sign(message, account_index = account_index, address_index = address_index)
signature = res.signature
for i in range(2):
- res = self.wallet[i].verify(message, self.address[0], signature)
+ res = self.wallet[i].verify(message, address[0], signature)
assert res.good
- res = self.wallet[i].verify('different', self.address[0], signature)
+ res = self.wallet[i].verify('different', address[0], signature)
assert not res.good
- res = self.wallet[i].verify(message, self.address[1], signature)
+ res = self.wallet[i].verify(message, address[1], signature)
assert not res.good
- res = self.wallet[i].verify(message, self.address[0], signature + 'x')
+ res = self.wallet[i].verify(message, address[0], signature + 'x')
assert not res.good
if __name__ == '__main__':