Skip to content

Commit

Permalink
chore: added format to bundle summary
Browse files Browse the repository at this point in the history
  • Loading branch information
troykessler committed Jun 13, 2024
1 parent 0fd0d71 commit 261bff9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions integrations/tendermint-ssync/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,14 @@ export default class TendermintSSync implements IRuntime {
}

async summarizeDataBundle(_: Validator, bundle: DataItem[]): Promise<string> {
// return format "height/chunkIndex/chunks"
return !!bundle.at(-1)
? `${bundle.at(-1)?.key}/${bundle.at(-1)?.value?.snapshot?.chunks ?? 0}`
: '';
// return format "height/format/chunkIndex/chunks"
const dataItem = bundle.at(-1);
if (!dataItem) {
return '';
}

const [height, chunkIndex] = dataItem.key.split('/').map((k) => +k);
return `${height}/${dataItem.value.snapshot.format}/${chunkIndex}/${dataItem.value.snapshot.chunks}`;
}

async nextKey(_: Validator, key: string): Promise<string> {
Expand Down

0 comments on commit 261bff9

Please sign in to comment.