Skip to content

Commit

Permalink
Ignore packets from server; fix clobbering time
Browse files Browse the repository at this point in the history
  • Loading branch information
Quantumplation committed Dec 10, 2024
1 parent 1702cdd commit 4584076
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions referee/referee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,10 @@ let timer = 15 * 60 * 1000; // 15 minute timer
hydra.onTxSeen = () => {
timeout = 60_000;
};
// Hacky :skull:
const originalOnPacket = hydra.onPacket;
hydra.onPacket = (_tx: any, packet: Packet) => {
originalOnPacket(_tx, packet);
if (!players[packet.from]) {
console.log(
`Saw a new packet from ${packet.from} with ephemeral key ${toHex(packet.ephemeralKey)}`,
Expand Down
4 changes: 4 additions & 0 deletions src/utils/HydraMultiplayer/dedicated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export class HydraMultiplayerDedicated extends HydraMultiplayer {
this.latestUTxO = utxos.find((u) => !u.datumHash && !u.assets.lovelace)!;
}
public trackKills(_tx: any, packet: Packet) {
// Ignore packets from the server
if (packet.from === 1) {
return;
}
this.clients[packet.from] = this.clients[packet.from] || { tic: 0, kills: [] };
this.clients[packet.from].kills = packet.kills;
this.clients[packet.from].tic += 1;
Expand Down

0 comments on commit 4584076

Please sign in to comment.