| 90 | } |
| 91 | |
| 92 | type Server struct { |
| 93 | Index uint32 |
| 94 | account *account.Account |
| 95 | poolActor *actorTypes.TxPoolActor |
| 96 | p2p *actorTypes.P2PActor |
| 97 | ledger *ledger.Ledger |
| 98 | incrValidator *increment.IncrementValidator |
| 99 | pid *actor.PID |
| 100 | |
| 101 | // some config |
| 102 | msgHistoryDuration uint32 |
| 103 | |
| 104 | // |
| 105 | // Note: |
| 106 | // 1. locking priority: metaLock > blockpool.Lock > peerpool.Lock |
| 107 | // 2. should never take exclusive lock on both blockpool and peerpool at the same time. |
| 108 | // 3. msgpool.Lock is independent, should have no exclusive overlap with other locks. |
| 109 | // |
| 110 | metaLock sync.RWMutex |
| 111 | completedBlockNum uint32 // ledger SaveBlockCompleted block num |
| 112 | currentBlockNum uint32 |
| 113 | LastConfigBlockNum uint32 |
| 114 | config *vconfig.ChainConfig |
| 115 | currentParticipantConfig *BlockParticipantConfig |
| 116 | |
| 117 | chainStore *ChainStore // block store |
| 118 | msgPool *MsgPool // consensus msg pool |
| 119 | blockPool *BlockPool // received block proposals |
| 120 | peerPool *PeerPool // consensus peers |
| 121 | syncer *Syncer |
| 122 | stateMgr *StateMgr |
| 123 | timer *EventTimer |
| 124 | |
| 125 | msgRecvC map[uint32]chan *p2pMsgPayload |
| 126 | msgC chan ConsensusMsg |
| 127 | bftActionC chan *BftAction |
| 128 | msgSendC chan *SendMsgEvent |
| 129 | sub *events.ActorSubscriber |
| 130 | quitC chan struct{} |
| 131 | quit bool |
| 132 | quitWg sync.WaitGroup |
| 133 | } |
| 134 | |
| 135 | func NewVbftServer(account *account.Account, txpool, p2p *actor.PID) (*Server, error) { |
| 136 | server := &Server{ |
nothing calls this directly
no outgoing calls
no test coverage detected