BlockSyncMgr is the manager class to deal with block sync
| 225 | |
| 226 | //BlockSyncMgr is the manager class to deal with block sync |
| 227 | type BlockSyncMgr struct { |
| 228 | flightBlocks map[common.Uint256][]*SyncFlightInfo //Map BlockHash => []SyncFlightInfo, using for manager all of those block flights |
| 229 | flightHeaders map[uint32]*SyncFlightInfo //Map HeaderHeight => SyncFlightInfo, using for manager all of those header flights |
| 230 | blocksCache *BlockCache //Map BlockHash => BlockInfo, using for cache the blocks receive from net, and waiting for commit to ledger |
| 231 | server *P2PServer //Pointer to the local node |
| 232 | syncBlockLock bool //Help to avoid send block sync request duplicate |
| 233 | syncHeaderLock bool //Help to avoid send header sync request duplicate |
| 234 | saveBlockLock bool //Help to avoid saving block concurrently |
| 235 | exitCh chan interface{} //ExitCh to receive exit signal |
| 236 | ledger *ledger.Ledger //ledger |
| 237 | lock sync.RWMutex //lock |
| 238 | nodeWeights map[uint64]*NodeWeight //Map NodeID => NodeStatus, using for getNextNode |
| 239 | } |
| 240 | |
| 241 | //NewBlockSyncMgr return a BlockSyncMgr instance |
| 242 | func NewBlockSyncMgr(server *P2PServer) *BlockSyncMgr { |
nothing calls this directly
no outgoing calls
no test coverage detected