XinFinOrg / XDPoSChain

Customer centric, Hybrid & Interoperable XinFin Network
https://www.xinfin.org
GNU Lesser General Public License v3.0
51 stars 63 forks source link

make database no corrupt when UpdateM1 fails during reorg #599

Closed gzliudan closed 2 months ago

gzliudan commented 2 months ago

Proposed changes

If node exit abnormally because UpdateM1() return error during reorg, the database become corrupted. When we start node at this time, the node will complain:

Fatal: Error starting protocol stack: missing block number for head header hash

This PR keep database in normal state when UpdateM1() fails by save the incoming blocks during reorg.

Types of changes

What types of changes does your code introduce to XDC network? Put an in the boxes that apply

Impacted Components

Which part of the codebase this PR will touch base on,

Put an in the boxes that apply

Checklist

Put an in the boxes once you have confirmed below actions (or provide reasons on not doing so) that

liam-lai commented 2 months ago

refer pr : https://github.com/XinFinOrg/XDPoSChain/pull/596