Skip to content
Permalink
Browse files

Tidying of block forging.

The previous formulation gave the possibility of having diverging genesis keys, if the genesis config were configured that way. Instead, we will now throw an error if such a situation occurs.
  • Loading branch information...
nc6 committed Jul 11, 2019
1 parent 74d86de commit d17523f8a42501479acedb3a7b1958e8ea4edd7a
Showing with 7 additions and 4 deletions.
  1. +7 −4 ouroboros-consensus/src/Ouroboros/Consensus/Demo/Ledger/Byron/Forge.hs
@@ -100,15 +100,18 @@ forgeBlock cfg curSlot curNo prevHash txs () = do
}

headerGenesisKey :: Crypto.VerificationKey
VerKeyCardanoDSIGN headerGenesisKey = pbftGenVerKey $ encNodeConfigP cfg

dlgCertificate :: CC.Delegation.Certificate
(headerGenesisKey, dlgCertificate) = case findDelegate of
dlgCertificate = case findDelegate of
Just x -> x
Nothing -> error "Issuer is not a valid genesis key delegate."
where
dlgMap = CC.Genesis.unGenesisDelegation pbftGenesisDlg
VerKeyCardanoDSIGN issuer = pbftVerKey $ encNodeConfigP cfg
findDelegate = fmap (\crt -> (CC.Delegation.issuerVK crt, crt))
. find (\crt -> CC.Delegation.delegateVK crt == issuer)
VerKeyCardanoDSIGN delegate = pbftVerKey $ encNodeConfigP cfg
findDelegate = find (\crt -> CC.Delegation.delegateVK crt == delegate
&& CC.Delegation.issuerVK crt == headerGenesisKey
)
$ Map.elems dlgMap

forge :: PBftFields PBftCardanoCrypto CC.Block.ToSign

0 comments on commit d17523f

Please sign in to comment.
You can’t perform that action at this time.