mirror of
https://github.com/pyMC-dev/pyMC_Repeater.git
synced 2026-08-07 01:13:11 +02:00
Refactor RepeaterHandler path management and enhance packet validation
- Removed redundant call to mark_seen() for duplicate packets. - Added validation to ensure hop count does not exceed the maximum limit before appending to the packet path. - Updated logic to check for path size constraints when appending hash bytes, improving packet processing efficiency.
This commit is contained in:
@@ -1031,10 +1031,6 @@ GOOD_PACKETS = [
|
||||
"Flood, path has 1 prior hop",
|
||||
lambda: _make_flood_packet(payload=b"\xDE\xAD", path=b"\x42")),
|
||||
|
||||
("good_flood_path_near_max",
|
||||
"Flood, path = MAX_PATH_SIZE - 1 (room for our hash)",
|
||||
lambda: _make_flood_packet(payload=b"\xFF", path=bytes(range(MAX_PATH_SIZE - 1)))),
|
||||
|
||||
("good_flood_binary_payload",
|
||||
"Flood, all-zero payload",
|
||||
lambda: _make_flood_packet(payload=b"\x00" * 16)),
|
||||
@@ -1112,6 +1108,11 @@ BAD_PACKETS = [
|
||||
lambda: _make_flood_packet(payload=b"\x01", path=bytes(range(MAX_PATH_SIZE))),
|
||||
"Path length"),
|
||||
|
||||
("bad_flood_path_near_max",
|
||||
"Flood, path = MAX_PATH_SIZE - 1 (63 hops; path_len encodes 0-63, cannot append)",
|
||||
lambda: _make_flood_packet(payload=b"\xFF", path=bytes(range(MAX_PATH_SIZE - 1))),
|
||||
"cannot append"),
|
||||
|
||||
("bad_path_over_max",
|
||||
"Path exceeds MAX_PATH_SIZE",
|
||||
lambda: _make_flood_packet(payload=b"\x01", path=bytes(range(MAX_PATH_SIZE + 5))),
|
||||
|
||||
Reference in New Issue
Block a user