import { Block } from 'shared/model/block' ; export const MIN_ROUND_BLOCK_HEIGHT = 2 ; export const isLessHeight = ( lastBlock , receivedBlock ) : boolean => { return receivedBlock . height < lastBlock . height ; } ; export const isNext = ( lastBlock , receivedBlock ) : boolean => { return lastBlock . height + 1 === receivedBlock . height ; } ; export const isEqualId = ( lastBlock , receivedBlock ) : boolean => { return lastBlock . id === receivedBlock . id ; } ; export const isEqualPreviousBlock = ( lastBlock , receivedBlock ) : boolean => { return lastBlock . previousBlockId === receivedBlock . previousBlockId ; } ; export const isEqualHeight = ( lastBlock , receivedBlock ) : boolean => { return lastBlock . height === receivedBlock . height ; } ; export const isGreatestHeight = ( lastBlock , receivedBlock ) : boolean => { return receivedBlock . height > lastBlock . height ; } ; export const isLastBlockInvalid = ( lastBlock , receivedBlock ) : boolean => { return receivedBlock . previousBlockId !== lastBlock . id && isNext ( lastBlock , receivedBlock ) ; } ; export const isBlockCanBeProcessed = ( lastBlock , receivedBlock ) : boolean => { return receivedBlock . previousBlockId === lastBlock . id ; } ; export const isNewer = ( lastBlock , receivedBlock ) : boolean => { return receivedBlock . createdAt > lastBlock . createdAt ; } ;