Skip to content

Commit

Permalink
fix: vote instantly invalid if empty bundle was found
Browse files Browse the repository at this point in the history
  • Loading branch information
troykessler committed Oct 24, 2023
1 parent 42135d3 commit 086ad8a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions common/protocol/src/methods/validate/validateBundleProposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,26 @@ export async function validateBundleProposal(
return true;
}

// vote invalid if bundle size is zero
this.logger.debug(`Validating bundle proposal by bundle size`);
this.logger.debug(`Proposed = ${this.pool.bundle_proposal!.bundle_size}`);

if (parseInt(this.pool.bundle_proposal!.data_size) === 0) {
this.logger.info(
`Found no data items on bundle downloaded from storage provider`
);

const success = await this.voteBundleProposal(
this.pool.bundle_proposal!.storage_id,
VOTE.INVALID
);
return success;
}

this.logger.info(
`Found data items = ${this.pool.bundle_proposal!.bundle_size}`
);

// vote invalid if data size does not match with proposed data size
this.logger.debug(`Validating bundle proposal by data size`);
this.logger.debug(`Proposed = ${this.pool.bundle_proposal!.data_size}`);
Expand Down

0 comments on commit 086ad8a

Please sign in to comment.