MCPcopy Create free account
hub / github.com/DNAProject/DNA / initVbftBlock

Function initVbftBlock

consensus/vbft/types.go:141–156  ·  view source on GitHub ↗
(block *types.Block, prevMerkleRoot common.Uint256)

Source from the content-addressed store, hash-verified

139}
140
141func initVbftBlock(block *types.Block, prevMerkleRoot common.Uint256) (*Block, error) {
142 if block == nil {
143 return nil, fmt.Errorf("nil block in initVbftBlock")
144 }
145
146 blkInfo := &vconfig.VbftBlockInfo{}
147 if err := json.Unmarshal(block.Header.ConsensusPayload, blkInfo); err != nil {
148 return nil, fmt.Errorf("unmarshal blockInfo: %s", err)
149 }
150
151 return &Block{
152 Block: block,
153 Info: blkInfo,
154 PrevBlockMerkleRoot: prevMerkleRoot,
155 }, nil
156}

Callers 2

TestInitVbftBlockFunction · 0.85
getBlockMethod · 0.85

Calls 1

ErrorfMethod · 0.80

Tested by 1

TestInitVbftBlockFunction · 0.68