mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-29 22:33:28 +01:00
Merge pull request #6433
7326b69
functional_tests: ensure signatures never reuse a timestamp (moneromooo-monero)082dd2c
functional_tests: ensure signed timestamps are fresh (moneromooo-monero)
This commit is contained in:
commit
4540afc51b
@ -27,6 +27,7 @@
|
|||||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "misc_language.h"
|
||||||
#include "string_tools.h"
|
#include "string_tools.h"
|
||||||
#include "rpc/rpc_payment_signature.h"
|
#include "rpc/rpc_payment_signature.h"
|
||||||
|
|
||||||
@ -69,6 +70,7 @@ int main(int argc, const char **argv)
|
|||||||
while (count--)
|
while (count--)
|
||||||
{
|
{
|
||||||
std::string signature = cryptonote::make_rpc_payment_signature(skey);
|
std::string signature = cryptonote::make_rpc_payment_signature(skey);
|
||||||
|
epee::misc_utils::sleep_no_w(1);
|
||||||
printf("%s\n", signature.c_str());
|
printf("%s\n", signature.c_str());
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -59,12 +59,14 @@ class RPCPaymentTest():
|
|||||||
return fields
|
return fields
|
||||||
|
|
||||||
def refill_signatures(self):
|
def refill_signatures(self):
|
||||||
|
self.signatures_time = time.time()
|
||||||
|
self.signatures = []
|
||||||
signatures = subprocess.check_output([self.make_test_signature, self.secret_key, '256']).decode('utf-8')
|
signatures = subprocess.check_output([self.make_test_signature, self.secret_key, '256']).decode('utf-8')
|
||||||
for line in signatures.split():
|
for line in signatures.split():
|
||||||
self.signatures.append(line.rstrip())
|
self.signatures.append(line.rstrip())
|
||||||
|
|
||||||
def get_signature(self):
|
def get_signature(self):
|
||||||
if len(self.signatures) == 0:
|
if len(self.signatures) == 0 or self.signatures_time + 10 < time.time():
|
||||||
self.refill_signatures()
|
self.refill_signatures()
|
||||||
s = self.signatures[0]
|
s = self.signatures[0]
|
||||||
self.signatures = self.signatures[1:]
|
self.signatures = self.signatures[1:]
|
||||||
|
Loading…
Reference in New Issue
Block a user