.
This commit is contained in:
@@ -101,8 +101,9 @@
|
||||
extension: true,
|
||||
local: true,
|
||||
seedphrase: true,
|
||||
readonly: false,
|
||||
connect: true,
|
||||
remote: false,
|
||||
remote: true,
|
||||
otp: false
|
||||
},
|
||||
debug: true
|
||||
@@ -1622,6 +1623,19 @@
|
||||
? userNameElement.textContent
|
||||
: 'User';
|
||||
|
||||
// Helper function to get thrower name
|
||||
function getThrowerName(bounce, bounceNumber) {
|
||||
const throwerPubkey = bounce.throwerPubkey;
|
||||
const thrower = discoveredThrowers.find(t => t.pubkey === throwerPubkey);
|
||||
|
||||
if (thrower && thrower.name !== 'Unnamed Thrower') {
|
||||
return thrower.name;
|
||||
}
|
||||
|
||||
// Fallback to generic naming
|
||||
return `Superball ${bounceNumber}`;
|
||||
}
|
||||
|
||||
// Start with user sending the outermost bounce
|
||||
let currentTime = baseTime;
|
||||
|
||||
@@ -1630,6 +1644,7 @@
|
||||
const bounceNumber = index + 1;
|
||||
const isFirst = (index === 0);
|
||||
const isLast = (index === bounces.length - 1);
|
||||
const throwerName = getThrowerName(bounce, bounceNumber);
|
||||
|
||||
if (isFirst) {
|
||||
// User sends the outermost routing event (first bounce created)
|
||||
@@ -1649,7 +1664,7 @@
|
||||
flow.push({
|
||||
time: currentTime,
|
||||
actor: `Relay (${relays.join(', ')})`,
|
||||
action: `Event available for Superball ${bounceNumber}`,
|
||||
action: `Event available for ${throwerName}`,
|
||||
size: routingEventSize
|
||||
});
|
||||
}
|
||||
@@ -1665,12 +1680,21 @@
|
||||
// Last bounce - posts final event
|
||||
const finalEventSize = JSON.stringify(finalEvent).length + paddingAdjustment;
|
||||
const finalRelays = getRelaysForBounce(bounceNumber);
|
||||
const delaySeconds = getDelayForBounce(bounceNumber);
|
||||
const paddingAdded = getPaddingAdjustmentForBounce(bounceNumber);
|
||||
|
||||
// Create detailed final action description
|
||||
let actionDescription = `Grabs message, waits ${delaySeconds} seconds`;
|
||||
if (paddingAdded > 0) {
|
||||
actionDescription += `, adds ${paddingAdded} bytes of padding`;
|
||||
}
|
||||
actionDescription += `, and publishes your original message to: ${finalRelays.join(', ')}`;
|
||||
|
||||
// Step 3: Superball decrypts and sends final message
|
||||
flow.push({
|
||||
time: currentTime,
|
||||
actor: `Superball ${bounceNumber}`,
|
||||
action: `Decrypts and publishes your original message`,
|
||||
actor: throwerName,
|
||||
action: actionDescription,
|
||||
size: Math.max(finalEventSize, 0)
|
||||
});
|
||||
|
||||
@@ -1685,14 +1709,24 @@
|
||||
} else {
|
||||
// Intermediate bounce - forwards to next superball
|
||||
const nextBounce = bounces[index + 1];
|
||||
const nextThrowerName = getThrowerName(nextBounce, bounceNumber + 1);
|
||||
const nextRoutingSize = JSON.stringify(nextBounce.routingEvent).length + paddingAdjustment;
|
||||
const nextRelays = getRelaysForBounce(bounceNumber + 1); // Next superball's relays
|
||||
const delaySeconds = getDelayForBounce(bounceNumber);
|
||||
const paddingAdded = getPaddingAdjustmentForBounce(bounceNumber);
|
||||
|
||||
// Create detailed forwarding action description
|
||||
let actionDescription = `Grabs message, waits ${delaySeconds} seconds`;
|
||||
if (paddingAdded > 0) {
|
||||
actionDescription += `, adds ${paddingAdded} bytes of padding`;
|
||||
}
|
||||
actionDescription += `, and forwards to: ${nextRelays.join(', ')}`;
|
||||
|
||||
// Step 3: Superball forwards to next relay
|
||||
flow.push({
|
||||
time: currentTime,
|
||||
actor: `Superball ${bounceNumber}`,
|
||||
action: `Forwards routing event to next hop`,
|
||||
actor: throwerName,
|
||||
action: actionDescription,
|
||||
size: Math.max(nextRoutingSize, 0)
|
||||
});
|
||||
|
||||
@@ -1701,7 +1735,7 @@
|
||||
flow.push({
|
||||
time: currentTime,
|
||||
actor: `Relay (${nextRelays.join(', ')})`,
|
||||
action: `Event available for Superball ${bounceNumber + 1}`,
|
||||
action: `Event available for ${nextThrowerName}`,
|
||||
size: Math.max(nextRoutingSize, 0)
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user