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

Struct BlockSyncMgr

p2pserver/block_sync.go:227–239  ·  view source on GitHub ↗

BlockSyncMgr is the manager class to deal with block sync

Source from the content-addressed store, hash-verified

225
226//BlockSyncMgr is the manager class to deal with block sync
227type 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
242func NewBlockSyncMgr(server *P2PServer) *BlockSyncMgr {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected