MinaProtocol / mina

Mina is a cryptocurrency protocol with a constant size blockchain, improving scaling while maintaining decentralization and security.
https://minaprotocol.com
Apache License 2.0
1.98k stars 526 forks source link

update parent_id at the very last #15541

Closed ghost-not-in-the-shell closed 2 months ago

ghost-not-in-the-shell commented 2 months ago

Explain your changes: This PR moves the update to parent_id to the very end. The reason is that if berkeley_migration app crashed before migration finished. Then blocks with null parent_id would be considered as garbage and would be removed once migration being restarted.

Explain how you tested your changes: I've tested this change with umt data. Without this change, if we crash just after the parent_id being set, then the block would not be removed and those block would be considered valid and the corresponding blocks_user_commands table would not be populated after restart migration

Checklist:

ghost-not-in-the-shell commented 2 months ago

!ci-build-me

ghost-not-in-the-shell commented 2 months ago

!ci-build-me

mrmr1993 commented 2 months ago

!approved-for-mainnet