Skip to content

Commit

Permalink
fix: state sent to be saved twice (#11488)
Browse files Browse the repository at this point in the history
Signed-off-by: Lazar Petrovic <lpetrovic05@gmail.com>
  • Loading branch information
lpetrovic05 committed Feb 13, 2024
1 parent 30e929d commit ac755d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Expand Up @@ -910,10 +910,12 @@ private void loadReconnectState(final SignedState signedState) {
// this guarantees that the platform status will be RECONNECT_COMPLETE before the state is saved
platformStatusManager.submitStatusAction(new ReconnectCompleteAction(signedState.getRound()));
latestImmutableState.setState(signedState.reserve("set latest immutable to reconnect state"));
stateManagementComponent.stateToLoad(signedState, SourceOfSignedState.RECONNECT);
savedStateController.reconnectStateReceived(
signedState.reserve("savedStateController.reconnectStateReceived"));
platformWiring.getSaveStateToDiskInput().put(signedState.reserve("save reconnect state to disk"));
// this will send the state to the signature collector which will send it to be written to disk.
// in the future, we might not send it to the collector because it already has all the signatures
// if this is the case, we must make sure to send it to the writer directly
stateManagementComponent.stateToLoad(signedState, SourceOfSignedState.RECONNECT);

loadStateIntoConsensus(signedState);

Expand Down
Expand Up @@ -18,7 +18,6 @@

import static com.swirlds.common.io.utility.FileUtils.deleteDirectoryAndLog;
import static com.swirlds.logging.legacy.LogMarker.EXCEPTION;
import static com.swirlds.logging.legacy.LogMarker.STATE_TO_DISK;
import static com.swirlds.platform.state.signed.StateToDiskReason.UNKNOWN;

import com.swirlds.base.time.Time;
Expand Down Expand Up @@ -126,7 +125,7 @@ public SignedStateFileManager(
final SignedState signedState = reservedSignedState.get();
if (signedState.hasStateBeenSavedToDisk()) {
logger.info(
STATE_TO_DISK.getMarker(),
EXCEPTION.getMarker(),
"Not saving signed state for round {} to disk because it has already been saved.",
signedState.getRound());
return null;
Expand Down

0 comments on commit ac755d1

Please sign in to comment.