From ea49d22bceca5bae19207cd612f816b6a5f2ec04 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Mon, 9 Sep 2024 13:20:54 +0200 Subject: [PATCH] Add test entrypoint to LXStamper --- LXMF/LXStamper.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/LXMF/LXStamper.py b/LXMF/LXStamper.py index 9bd58de..28cf9cd 100644 --- a/LXMF/LXStamper.py +++ b/LXMF/LXStamper.py @@ -260,4 +260,21 @@ def job_android(stamp_cost, workblock): RNS.log(f"Stamp generation job error: {e}") RNS.trace_exception(e) - return stamp, total_rounds \ No newline at end of file + return stamp, total_rounds + +if __name__ == "__main__": + import sys + if len(sys.argv) < 2: + RNS.log("No cost argument provided", RNS.LOG_ERROR) + exit(1) + else: + try: + cost = int(sys.argv[1]) + except Exception as e: + RNS.log(f"Invalid cost argument provided: {e}", RNS.LOG_ERROR) + exit(1) + + RNS.loglevel = RNS.LOG_DEBUG + RNS.log("Testing LXMF stamp generation", RNS.LOG_DEBUG) + message_id = os.urandom(32) + generate_stamp(message_id, cost) \ No newline at end of file