witnet-rust
witnet-rust copied to clipboard
Use same storage with different consensus constants in mainnet
This is one of the problems that are blocking #1583. The simplest solution would be to return an error if there is already a ChainState with different consensus constants.
Now the node checks if there is more than one ChainState in the storage before starting, and it panics if there is more than one, or if the one in the storage has a different magic number than expected.
See here:
https://github.com/witnet/witnet-rust/blob/c36f3b11fa2e385f4f9bc6f6de672f23c5da9740/node/src/actors/chain_manager/actor.rs#L434
But it still doesn't allow to change the mainnet consensus constants, as that results in an error.
That would certainly be a first step towards changing the magic numbers through a TAPI upgrade.
The other part would be to make TAPI select the magic number sent in protocol messages (change number only after activation), but keep accepting messages with the former number, so as to prevent all nodes dropping and icing peers at once.