Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions discojs/src/client/decentralized/decentralized_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,9 @@ export class DecentralizedClient extends Client<"decentralized"> {
if (connections === undefined)
throw new Error("peer's connections is undefined");
// Generate our payloads for this communication round and send them to all ready connected peers
// Aggregation may complete while payloads are being encoded and sent, so
// every contribution in this exchange must retain the same round number.
const aggregationRound = this.aggregator.round;
const payloads = this.aggregator.makePayloads(result);
await Promise.all(
payloads
Expand All @@ -496,7 +499,7 @@ export class DecentralizedClient extends Client<"decentralized"> {
this.aggregator.add(
this.ownId,
payload,
this.aggregator.round,
aggregationRound,
communicationRound,
);
return;
Expand All @@ -510,7 +513,7 @@ export class DecentralizedClient extends Client<"decentralized"> {
const msg: messages.PeerMessage = {
type: MType.Payload,
peer: id,
aggregationRound: this.aggregator.round,
aggregationRound,
communicationRound,
payload: encoded,
};
Expand All @@ -520,7 +523,7 @@ export class DecentralizedClient extends Client<"decentralized"> {
debug(
`[${shortenId(this.ownId)}] send weight update to peer ${shortenId(msg.peer)}` +
` for round (%d, %d)`,
this.aggregator.round,
aggregationRound,
communicationRound,
);
})
Expand Down
Loading