OSDN Git Service

Merge branch 'v0.1' into edit
[bytom/vapor.git] / protocol / protocol.go
index 1331d7f..73156e9 100644 (file)
@@ -117,6 +117,12 @@ func (c *Chain) InMainChain(hash bc.Hash) bool {
        return c.index.InMainchain(hash)
 }
 
+func (c *Chain) IrreversibleBlockHeight() uint64 {
+       c.cond.L.Lock()
+       defer c.cond.L.Unlock()
+       return c.bestIrreversibleNode.Height
+}
+
 // This function must be called with mu lock in above level
 func (c *Chain) setState(node *state.BlockNode, irreversibleNode *state.BlockNode, view *state.UtxoViewpoint, voteMap map[uint64]*state.VoteResult) error {
        if err := c.store.SaveChainStatus(node, irreversibleNode, view, voteMap); err != nil {