Golang implemented sidechain for Bytom
Revision | 52a25953b8c5025182b216b745d536227b9377f9 (tree) |
---|---|
Time | 2020-09-22 21:31:12 |
Author | Chengcheng Zhang <943420582@qq.c...> |
Commiter | Chengcheng Zhang |
update
@@ -270,15 +270,13 @@ func (s *sidechainKeeper) syncBlock() (bool, error) { | ||
270 | 270 | return false, errors.Wrap(err, "query chain") |
271 | 271 | } |
272 | 272 | |
273 | - height, err := s.node.GetBlockCount() | |
273 | + netInfo, err := s.node.GetNetInfo() | |
274 | 274 | if err != nil { |
275 | 275 | return false, err |
276 | 276 | } |
277 | 277 | |
278 | - if shouldUpdate, err := s.shouldUpdate(height); err != nil { | |
279 | - return false, err | |
280 | - } else if !shouldUpdate { | |
281 | - return true, nil | |
278 | + if netInfo.IrreversibleBlock <= chain.BlockHeight+s.cfg.Confirmations { | |
279 | + return false, nil | |
282 | 280 | } |
283 | 281 | |
284 | 282 | nextBlockStr, txStatus, err := s.node.GetBlockByHeight(chain.BlockHeight + 1) |