func (s *State) NewAdminBlockHeader() interfaces.IABlockHeader { header := new(adminBlock.ABlockHeader) header.DBHeight = s.GetDBHeight() if s.GetCurrentAdminBlock() == nil { header.PrevLedgerKeyMR = primitives.NewHash(constants.ZERO_HASH) } else { keymr, err := s.GetCurrentAdminBlock().LedgerKeyMR() if err != nil { panic(err.Error()) } header.PrevLedgerKeyMR = keymr } header.HeaderExpansionSize = 0 header.HeaderExpansionArea = make([]byte, 0) header.MessageCount = 0 header.BodySize = 0 return header }
func CreateTestAdminHeader(prev *adminBlock.AdminBlock) *adminBlock.ABlockHeader { header := new(adminBlock.ABlockHeader) if prev == nil { header.PrevLedgerKeyMR = primitives.NewZeroHash() header.DBHeight = 0 } else { keyMR, err := prev.GetKeyMR() if err != nil { panic(err) } header.PrevLedgerKeyMR = keyMR header.DBHeight = prev.Header.GetDBHeight() + 1 } header.HeaderExpansionSize = 5 header.HeaderExpansionArea = []byte{0x00, 0x01, 0x02, 0x03, 0x04} header.MessageCount = 0 header.BodySize = 0 return header }