mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-23 11:23:26 +01:00
functional_tests: speed up signature generation
Executing a new binary for each signature can get really slow
This commit is contained in:
parent
e69acffdc8
commit
f5a11f05fe
@ -33,9 +33,9 @@
|
|||||||
int main(int argc, const char **argv)
|
int main(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
TRY_ENTRY();
|
TRY_ENTRY();
|
||||||
if (argc > 2)
|
if (argc > 3)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "usage: %s <secret_key>\n", argv[0]);
|
fprintf(stderr, "usage: %s [<secret_key> [N]]\n", argv[0]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,8 +55,22 @@ int main(int argc, const char **argv)
|
|||||||
fprintf(stderr, "invalid secret key\n");
|
fprintf(stderr, "invalid secret key\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
uint32_t count = 1;
|
||||||
|
if (argc == 3)
|
||||||
|
{
|
||||||
|
int i = atoi(argv[2]);
|
||||||
|
if (i <= 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "invalid count\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
count = (uint32_t)i;
|
||||||
|
}
|
||||||
|
while (count--)
|
||||||
|
{
|
||||||
std::string signature = cryptonote::make_rpc_payment_signature(skey);
|
std::string signature = cryptonote::make_rpc_payment_signature(skey);
|
||||||
printf("%s\n", signature.c_str());
|
printf("%s\n", signature.c_str());
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
CATCH_ENTRY_L0("main()", 1);
|
CATCH_ENTRY_L0("main()", 1);
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ class RPCPaymentTest():
|
|||||||
self.make_test_signature = os.environ['MAKE_TEST_SIGNATURE']
|
self.make_test_signature = os.environ['MAKE_TEST_SIGNATURE']
|
||||||
assert len(self.make_test_signature) > 0
|
assert len(self.make_test_signature) > 0
|
||||||
self.secret_key, self.public_key = self.get_keys()
|
self.secret_key, self.public_key = self.get_keys()
|
||||||
|
self.signatures = []
|
||||||
self.reset()
|
self.reset()
|
||||||
self.test_access_tracking()
|
self.test_access_tracking()
|
||||||
self.test_access_mining()
|
self.test_access_mining()
|
||||||
@ -57,8 +58,17 @@ class RPCPaymentTest():
|
|||||||
assert len(fields) == 2
|
assert len(fields) == 2
|
||||||
return fields
|
return fields
|
||||||
|
|
||||||
|
def refill_signatures(self):
|
||||||
|
signatures = subprocess.check_output([self.make_test_signature, self.secret_key, '256']).decode('utf-8')
|
||||||
|
for line in signatures.split():
|
||||||
|
self.signatures.append(line.rstrip())
|
||||||
|
|
||||||
def get_signature(self):
|
def get_signature(self):
|
||||||
return subprocess.check_output([self.make_test_signature, self.secret_key]).decode('utf-8').rstrip()
|
if len(self.signatures) == 0:
|
||||||
|
self.refill_signatures()
|
||||||
|
s = self.signatures[0]
|
||||||
|
self.signatures = self.signatures[1:]
|
||||||
|
return s
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
print('Resetting blockchain')
|
print('Resetting blockchain')
|
||||||
|
Loading…
Reference in New Issue
Block a user