-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(p2p): download messages from higher round (#261)
* Download messages if round is higher * Check download messages * Check our header * Signatures count in header * Fix higher round handling * Remove RoundState from header * Use readonly * Set downloads by round * Round state returns prevotes and precommits * Return array * Return latest round with minority * Extract check message * Extract check response * Split check response * Support full download * Cleanup * Don't decrease below requested round * Fixes * Fix getMessages * Check messages have same round and height * REmove console.log * Typo * Move can download check to downloader * Calculate round * Remove TODOS * Move method * Extract method * Calculate round * Cleanup * Rename methods * Determine reponse check based on response * Ensure that round is higher for full download * Add round and height to DownloadJob * Move can downloadProposal inside proposal downloader * Rename field * Add round and height to job * Set proposal on header * Move download check * Allow 2 sequential proposals * Fix minority check
- Loading branch information
1 parent
d18d3d8
commit 9af1ac1
Showing
8 changed files
with
400 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
import { IRoundState } from "../consensus/consensus"; | ||
import { Contracts } from "../.."; | ||
|
||
export type IHeaderData = { | ||
version: string; | ||
height: number; | ||
round: number; | ||
step: number; | ||
proposedBlockId?: string; | ||
validatorsSignedPrevote: boolean[]; | ||
validatorsSignedPrecommit: boolean[]; | ||
validatorsSignedPrevote: readonly boolean[]; | ||
validatorsSignedPrecommit: readonly boolean[]; | ||
}; | ||
|
||
export interface IHeader { | ||
height: number; | ||
round: number; | ||
roundState: IRoundState; | ||
proposal?: Contracts.Crypto.IProposal; | ||
validatorsSignedPrecommit: readonly boolean[]; | ||
validatorsSignedPrevote: readonly boolean[]; | ||
|
||
toData(): IHeaderData; | ||
canDownloadProposal(headerData: IHeaderData): boolean; | ||
canDownloadMessages(headerData: IHeaderData): boolean; | ||
getValidatorsSignedPrecommitCount(): number; | ||
getValidatorsSignedPrevoteCount(): number; | ||
} | ||
|
||
export type HeaderFactory = () => IHeader; |
Oops, something went wrong.