cardano-sl-0.4.3: Cardano SL main implementation

Safe HaskellNone
LanguageHaskell2010

Pos.Block.Network

Synopsis

Documentation

announceBlock :: WorkMode ssc m => m (Set NodeId) -> SendActions m -> MainBlockHeader ssc -> m () Source #

needRecovery :: forall ssc m. (SscWorkersClass ssc, WorkMode ssc m) => Proxy ssc -> m Bool Source #

triggerRecovery :: forall ssc m. (SscWorkersClass ssc, WorkMode ssc m) => m (Set NodeId) -> SendActions m -> m () Source #

Triggers recovery based on established communication.

requestTip :: forall ssc s m. (SscWorkersClass ssc, WorkMode ssc m) => Proxy s -> NodeId -> ConversationActions MsgGetHeaders (LimitedLength s (MsgHeaders ssc)) m -> m () Source #

Is used if we're recovering after offline and want to know what's current blockchain state. Sends "what's your current tip" request to everybody we know.

mkHeadersRequest :: forall ssc m. WorkMode ssc m => Maybe HeaderHash -> m (Maybe MsgGetHeaders) Source #

Make GetHeaders message using our main chain. This function chooses appropriate from hashes and puts them into GetHeaders message.

mkBlocksRequest :: HeaderHash -> HeaderHash -> MsgGetBlocks Source #

Make message which requests chain of blocks which is based on our tip. LcaChild is the first block after LCA we don't know. WantedBlock is the newest one we want to get.

handleBlocks :: forall ssc m. (MonadDBCore m, SscWorkersClass ssc, WorkMode ssc m) => m (Set NodeId) -> NodeId -> OldestFirst NE (Block ssc) -> SendActions m -> m () Source #

retrievalWorker :: forall ssc m. (MonadDBCore m, SscWorkersClass ssc, WorkMode ssc m) => m (Set NodeId) -> (WorkerSpec m, OutSpecs) Source #

data MsgGetHeaders Source #

GetHeaders message. Behaviour of the response depends on particular combination of mghFrom and mghTo.

  • mghTo resolves to some header (let's call it top for convenience) -- node's tip if it's Nothing, header with hash in Just if it's Just.
  • If mghFrom is empty, then semantics is "request to return header of block top".
  • Otherwise (if mghFrom isn't empty) it represents the set of checkpoints. Responding node will try to iterate headers from top to older until it reaches any checkpoint. If it finds checkpoint c, it returns all headers in range [c.next..top]. If it doesn't find any checkpoint or depth of searching exceeds recoveryHeadersMessage, it will try to find the newest checkpoint cc from mghFrom that's in main chain of responding node and then return at most recoveryHeadersMessage headers starting with cc as the oldest one, returning headers in range l2 = [cc.next..x] where x is either top (in case length l2 < recoveryHeadersMessage) or some arbitrary header (and length is precisely recoveryHeadersMessage).

Constructors

MsgGetHeaders 

Fields

data MsgGetBlocks Source #

GetBlocks message (see protocol specification).

Constructors

MsgGetBlocks 

newtype MsgHeaders ssc Source #

Headers message (see protocol specification).

Constructors

MsgHeaders (NewestFirst NE (BlockHeader ssc)) 

Instances

Ssc ssc => Eq (MsgHeaders ssc) Source # 

Methods

(==) :: MsgHeaders ssc -> MsgHeaders ssc -> Bool #

(/=) :: MsgHeaders ssc -> MsgHeaders ssc -> Bool #

Ssc ssc => Show (MsgHeaders ssc) Source # 

Methods

showsPrec :: Int -> MsgHeaders ssc -> ShowS #

show :: MsgHeaders ssc -> String #

showList :: [MsgHeaders ssc] -> ShowS #

Generic (MsgHeaders ssc) Source # 

Associated Types

type Rep (MsgHeaders ssc) :: * -> * #

Methods

from :: MsgHeaders ssc -> Rep (MsgHeaders ssc) x #

to :: Rep (MsgHeaders ssc) x -> MsgHeaders ssc #

type Rep (MsgHeaders ssc) Source # 
type Rep (MsgHeaders ssc) = D1 (MetaData "MsgHeaders" "Pos.Block.Network.Types" "cardano-sl-0.4.3-Ku3Vny2rTNkDjtuqkt7DM9" True) (C1 (MetaCons "MsgHeaders" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NewestFirst NE (BlockHeader ssc)))))
type LimitType (MsgHeaders ssc) # 

newtype MsgBlock ssc Source #

Block message (see protocol specification).

Constructors

MsgBlock (Block ssc) 

Instances

(Ssc ssc, Eq (SscPayload ssc)) => Eq (MsgBlock ssc) Source # 

Methods

(==) :: MsgBlock ssc -> MsgBlock ssc -> Bool #

(/=) :: MsgBlock ssc -> MsgBlock ssc -> Bool #

Ssc ssc => Show (MsgBlock ssc) Source # 

Methods

showsPrec :: Int -> MsgBlock ssc -> ShowS #

show :: MsgBlock ssc -> String #

showList :: [MsgBlock ssc] -> ShowS #

Generic (MsgBlock ssc) Source # 

Associated Types

type Rep (MsgBlock ssc) :: * -> * #

Methods

from :: MsgBlock ssc -> Rep (MsgBlock ssc) x #

to :: Rep (MsgBlock ssc) x -> MsgBlock ssc #

type Rep (MsgBlock ssc) Source # 
type Rep (MsgBlock ssc) = D1 (MetaData "MsgBlock" "Pos.Block.Network.Types" "cardano-sl-0.4.3-Ku3Vny2rTNkDjtuqkt7DM9" True) (C1 (MetaCons "MsgBlock" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Block ssc))))
type LimitType (MsgBlock ssc) # 
type LimitType (MsgBlock ssc) = Limit (MsgBlock ssc)