Multibyte: fix map

This commit is contained in:
HDDen
2026-05-28 02:20:56 +03:00
parent 6e81fdfd46
commit 2e4f26d7cd
8 changed files with 338 additions and 267 deletions
+13 -11
View File
@@ -115,9 +115,10 @@ class _PathTraceMapScreenState extends State<PathTraceMapScreen> {
Uint8List? _sentTagBytes;
String _formatPathPrefixes(Uint8List pathBytes) {
return PathHelper.splitPathBytes(pathBytes, widget.pathHashByteWidth)
.map(PathHelper.formatHopHex)
.join(',');
return PathHelper.splitPathBytes(
pathBytes,
widget.pathHashByteWidth,
).map(PathHelper.formatHopHex).join(',');
}
@override
@@ -327,7 +328,8 @@ class _PathTraceMapScreenState extends State<PathTraceMapScreen> {
// Check if it's a binary response
if (frame.length >= 12 &&
code == pushCodeTraceData &&
(listEquals(frame.sublist(4, 8), _sentTagBytes) || listEquals(frame.sublist(4, 8), tagData))) {
(listEquals(frame.sublist(4, 8), _sentTagBytes) ||
listEquals(frame.sublist(4, 8), tagData))) {
_timeoutTimer?.cancel();
if (!mounted) return;
_handleTraceResponse(frame);
@@ -370,10 +372,7 @@ class _PathTraceMapScreenState extends State<PathTraceMapScreen> {
buffer.skipBytes(5); // Skip Flag byte and tag data
buffer.skipBytes(4); // Skip auth code
final pathBytes = buffer.readBytes(pathLength);
final pathData = PathHelper.splitPathBytes(
pathBytes,
width,
);
final pathData = PathHelper.splitPathBytes(pathBytes, width);
List<double> snrData = buffer
.readRemainingBytes()
.map((snr) => snr.toSigned(8).toDouble() / 4)
@@ -414,7 +413,10 @@ class _PathTraceMapScreenState extends State<PathTraceMapScreen> {
for (final repeaterData in pathData) {
final hopWidth = repeaterData.length;
if (repeater.publicKey.length < hopWidth) continue;
if (listEquals(repeater.publicKey.sublist(0, hopWidth), repeaterData)) {
if (listEquals(
repeater.publicKey.sublist(0, hopWidth),
repeaterData,
)) {
pathContacts[_hopKey(repeaterData)] = repeater;
lastContact = repeater;
}
@@ -434,8 +436,8 @@ class _PathTraceMapScreenState extends State<PathTraceMapScreen> {
(c) =>
c.hasLocation &&
c.path.isNotEmpty &&
_hopKey(_lastHopChunk(c.path, widget.pathHashByteWidth)) ==
hopKey,
_hopKey(_lastHopChunk(c.path, widget.pathHashByteWidth)) ==
hopKey,
)
.toList();
if (peers.isNotEmpty) {