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

Method ReloadFromLedger

consensus/vbft/chain_store.go:99–115  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

97}
98
99func (self *ChainStore) ReloadFromLedger() {
100 height := self.db.GetCurrentBlockHeight()
101 if height > self.chainedBlockNum {
102 // update chainstore height
103 self.chainedBlockNum = height
104 // remove persisted pending blocks
105 newPending := make(map[uint32]*PendingBlock)
106 for blkNum, blk := range self.pendingBlocks {
107 if blkNum > height {
108 newPending[blkNum] = blk
109 }
110 }
111 log.Debug("chainstore ReloadFromLedger pendingBlocks")
112 // update pending blocks
113 self.pendingBlocks = newPending
114 }
115}
116
117func (self *ChainStore) AddBlock(block *Block) error {
118 if block == nil {

Callers 1

Calls 2

DebugFunction · 0.92
GetCurrentBlockHeightMethod · 0.65

Tested by

no test coverage detected