mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-24 14:35:45 +00:00
moved on_rollback behaviour to planetmint
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
parent
7dec1b16ab
commit
54e821ebaf
@ -947,6 +947,11 @@ class Planetmint(object):
|
|||||||
elections = self._get_votes(txns)
|
elections = self._get_votes(txns)
|
||||||
for election_id in elections:
|
for election_id in elections:
|
||||||
election = self.get_transaction(election_id)
|
election = self.get_transaction(election_id)
|
||||||
election.on_rollback(self, new_height)
|
# election.on_rollback(self, new_height)
|
||||||
|
if election.operation == VALIDATOR_ELECTION:
|
||||||
|
# TODO change to `new_height + 2` when upgrading to Tendermint 0.24.0.
|
||||||
|
self.delete_validator_set(new_height + 1)
|
||||||
|
if election.operation == CHAIN_MIGRATION_ELECTION:
|
||||||
|
self.delete_abci_chain(new_height)
|
||||||
|
|
||||||
Block = namedtuple("Block", ("app_hash", "height", "transactions"))
|
Block = namedtuple("Block", ("app_hash", "height", "transactions"))
|
||||||
|
|||||||
@ -17,6 +17,3 @@ class ChainMigrationElection(Election):
|
|||||||
|
|
||||||
def on_approval(self, planet, *args, **kwargs): # TODO: move somewhere else
|
def on_approval(self, planet, *args, **kwargs): # TODO: move somewhere else
|
||||||
planet.migrate_abci_chain()
|
planet.migrate_abci_chain()
|
||||||
|
|
||||||
def on_rollback(self, planet, new_height): # TODO: move somewhere else
|
|
||||||
planet.delete_abci_chain(new_height)
|
|
||||||
|
|||||||
@ -73,9 +73,3 @@ class Election(Transaction):
|
|||||||
other concluded elections, if required.
|
other concluded elections, if required.
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def on_rollback(self, planet, new_height):
|
|
||||||
"""Override to clean up the database artifacts possibly created
|
|
||||||
in `on_approval`. Part of the `end_block`/`commit` crash recovery.
|
|
||||||
"""
|
|
||||||
raise NotImplementedError
|
|
||||||
|
|||||||
@ -31,7 +31,3 @@ class ValidatorElection(Election):
|
|||||||
# TODO change to `new_height + 2` when upgrading to Tendermint 0.24.0.
|
# TODO change to `new_height + 2` when upgrading to Tendermint 0.24.0.
|
||||||
planet.store_validator_set(new_height + 1, updated_validator_set)
|
planet.store_validator_set(new_height + 1, updated_validator_set)
|
||||||
return encode_validator(self.asset["data"])
|
return encode_validator(self.asset["data"])
|
||||||
|
|
||||||
def on_rollback(self, planetmint, new_height): # TODO: move somewhere else
|
|
||||||
# TODO change to `new_height + 2` when upgrading to Tendermint 0.24.0.
|
|
||||||
planetmint.delete_validator_set(new_height + 1)
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user