github.com/klaytn/klaytn@v1.12.1/consensus/istanbul/core/doc.go (about) 1 // Copyright 2018 The klaytn Authors 2 // This file is part of the klaytn library. 3 // 4 // The klaytn library is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU Lesser General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // The klaytn library is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU Lesser General Public License for more details. 13 // 14 // You should have received a copy of the GNU Lesser General Public License 15 // along with the klaytn library. If not, see <http://www.gnu.org/licenses/>. 16 17 /* 18 Package core implements the core functionality of Istanbul consensus engine. 19 The package defines `core` struct which stores all current consensus status such as validator set and round status. 20 It also has accompanying methods to handle and broadcast messages between nodes. 21 22 In Istanbul consensus, there are 3 phases including Preprepare, Prepare and Commit. 23 Each phase has its own message and by handling these messages the consensus can be made. 24 25 When a consensus is made for a given block, core communicates with the Istanbul backend to proceed. 26 27 Source Files 28 29 Core package is composed of following files 30 - `backlog.go`: Implements core methods handling future messages. The future message is a message which has future timestamp or in a different phase 31 - `commit.go`: Implements core methods which send, receive, handle, verify and accept commit messages 32 - `core.go`: Defines core struct and its methods related to timer setup, start new round and round state update 33 - `errors.go`: Defines consensus message related errors 34 - `events.go`: Defines backlog event and timeout event 35 - `final_committed.go`: Start a new round when a final committed proposal is stored 36 - `handler.go`: Implements core.Engine.Start and Stop. Provides event and message hendlers 37 - `message_set.go`: Defines messageSet struct which has a validator set and messages from other nodes 38 - `prepare.go`: Implements core methods which send, receive, handle, verify and accept prepare phase messages 39 - `preprepare.go`: Implements core methods which send, handle and accept preprepare messages 40 - `request.go`: Implements core methods which handle, check, store and process preprepare messages 41 - `roundchange.go`: Implement core methods receiving and handling roundchange messages 42 - `roundstate.go`: Defines roundState struct which has messages of each phase for a round 43 - `types.go`: Defines Engine interface and message, State type 44 */ 45 package core