Add test entrypoint to LXStamper

This commit is contained in:
Mark Qvist 2024-09-09 13:20:54 +02:00
parent 058186dfdc
commit ea49d22bce

View File

@ -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
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)