Compare commits

...
4 Commits
6 changed files with 27 additions and 5 deletions

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
Reticulum License
Copyright (c) 2020-2025 Mark Qvist
Copyright (c) 2020-2026 Mark Qvist
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+3 -1
View File
@@ -410,7 +410,7 @@ class LXMRouter:
da_thread.setDaemon(True)
da_thread.start()
def register_delivery_identity(self, identity, display_name = None, stamp_cost = None):
def register_delivery_identity(self, identity, display_name=None, stamp_cost=None, stamp_value=None):
if len(self.delivery_destinations) != 0:
RNS.log("Currently only one delivery identity is supported per LXMF router instance", RNS.LOG_ERROR)
return None
@@ -419,6 +419,7 @@ class LXMRouter:
os.makedirs(self.ratchetpath)
delivery_destination = RNS.Destination(identity, RNS.Destination.IN, RNS.Destination.SINGLE, APP_NAME, "delivery")
if stamp_value: delivery_destination.set_value(stamp_value)
delivery_destination.set_link_cost(self.DELIVERY_LINK_COST)
delivery_destination.enable_ratchets(f"{self.ratchetpath}/{RNS.hexrep(delivery_destination.hash, delimit=False)}.ratchets")
delivery_destination.set_packet_callback(self.delivery_packet)
@@ -497,6 +498,7 @@ class LXMRouter:
pn_app_data = RNS.Identity.recall_app_data(pn_destination_hash)
if pn_announce_data_is_valid(pn_app_data):
pn_config = msgpack.unpackb(pn_app_data)
# TODO: Transitional mechanism, remove after 1.6.2
if len(pn_config) > 7: target_propagation_cost = pn_config[7][0]
else: target_propagation_cost = pn_config[5][0]
+8
View File
@@ -292,6 +292,14 @@ class LXMessage:
if self.stamp == None:
return False
else:
# Transitory mechanism, check non-expanded workblock validity first. ######
workblock_ne = LXStamper.stamp_workblock(self.message_id, no_expand=True) #
if LXStamper.stamp_valid(self.stamp, target_cost, workblock_ne): #
RNS.log(f"Stamp (NE) on {self} validated", RNS.LOG_DEBUG) #
self.stamp_value = LXStamper.stamp_value(workblock_ne, self.stamp) #
return True #
###########################################################################
workblock = LXStamper.stamp_workblock(self.message_id)
if LXStamper.stamp_valid(self.stamp, target_cost, workblock):
RNS.log(f"Stamp on {self} validated", RNS.LOG_DEBUG) # TODO: Remove at some point
+13 -1
View File
@@ -24,6 +24,11 @@ def generate_stamp(message_id, stamp_cost, expand_rounds=WORKBLOCK_EXPAND_ROUNDS
return RNS.Stamps.generate_stamp(message_id, stamp_cost, expand_rounds=expand_rounds, no_expand=no_expand, size=STAMP_SIZE)
def validate_peering_key(peering_id, peering_key, target_cost):
# Transitory mechanism, check non-expanded workblock validity first. ##
workblock_ne = stamp_workblock(peering_id, no_expand=True) #
if stamp_valid(peering_key, target_cost, workblock_ne): return True #
#######################################################################
workblock = stamp_workblock(peering_id, expand_rounds=WORKBLOCK_EXPAND_ROUNDS_PEERING)
if not stamp_valid(peering_key, target_cost, workblock): return False
else: return True
@@ -35,8 +40,15 @@ def validate_pn_stamp(transient_data, target_cost):
lxm_data = transient_data[:-STAMP_SIZE]
stamp = transient_data[-STAMP_SIZE:]
transient_id = RNS.Identity.full_hash(lxm_data)
workblock = stamp_workblock(transient_id, expand_rounds=WORKBLOCK_EXPAND_ROUNDS_PN)
# Transitory mechanism, check non-expanded workblock validity first. ##
workblock_ne = stamp_workblock(transient_id, no_expand=True) #
if stamp_valid(stamp, target_cost, workblock_ne): #
value = stamp_value(workblock_ne, stamp) #
return transient_id, lxm_data, value, stamp #
#######################################################################
workblock = stamp_workblock(transient_id, expand_rounds=WORKBLOCK_EXPAND_ROUNDS_PN)
if not stamp_valid(stamp, target_cost, workblock): return None, None, None, None
else:
value = stamp_value(workblock, stamp)
+1 -1
View File
@@ -1 +1 @@
__version__ = "1.3.0"
__version__ = "1.3.1"
+1 -1
View File
@@ -31,6 +31,6 @@ setuptools.setup(
'lxmd=LXMF.Utilities.lxmd:main',
]
},
install_requires=["rns>=1.6.0"],
install_requires=["rns>=1.6.1"],
python_requires=">=3.7",
)