Skip to content

Commit

Permalink
Stopped RecoveryLogs store from being created when `IgnoreRecoveryL…
Browse files Browse the repository at this point in the history
…ogs` is `true` (#3444)

Co-authored-by: Shargon <[email protected]>
  • Loading branch information
cschuchardt88 and shargon committed Aug 6, 2024
1 parent 6278961 commit bd820fb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Plugins/DBFTPlugin/Consensus/ConsensusContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ public ConsensusContext(NeoSystem neoSystem, Settings settings, Wallet wallet)
this.wallet = wallet;
this.neoSystem = neoSystem;
dbftSettings = settings;
store = neoSystem.LoadStore(settings.RecoveryLogs);

if (dbftSettings.IgnoreRecoveryLogs == false)
store = neoSystem.LoadStore(settings.RecoveryLogs);
}

public Block CreateBlock()
Expand Down Expand Up @@ -168,7 +170,7 @@ public Block EnsureHeader()

public bool Load()
{
byte[] data = store.TryGet(ConsensusStateKey);
byte[] data = store?.TryGet(ConsensusStateKey);
if (data is null || data.Length == 0) return false;
MemoryReader reader = new(data);
try
Expand Down Expand Up @@ -272,7 +274,7 @@ public void Reset(byte viewNumber)

public void Save()
{
store.PutSync(ConsensusStateKey, this.ToArray());
store?.PutSync(ConsensusStateKey, this.ToArray());
}

public void Deserialize(ref MemoryReader reader)
Expand Down

0 comments on commit bd820fb

Please sign in to comment.