Skip to content

Commit bd820fb

Browse files
Stopped RecoveryLogs store from being created when IgnoreRecoveryLogs is true (#3444)
Co-authored-by: Shargon <shargon@gmail.com>
1 parent 6278961 commit bd820fb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Plugins/DBFTPlugin/Consensus/ConsensusContext.cs

+5-3
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ public ConsensusContext(NeoSystem neoSystem, Settings settings, Wallet wallet)
116116
this.wallet = wallet;
117117
this.neoSystem = neoSystem;
118118
dbftSettings = settings;
119-
store = neoSystem.LoadStore(settings.RecoveryLogs);
119+
120+
if (dbftSettings.IgnoreRecoveryLogs == false)
121+
store = neoSystem.LoadStore(settings.RecoveryLogs);
120122
}
121123

122124
public Block CreateBlock()
@@ -168,7 +170,7 @@ public Block EnsureHeader()
168170

169171
public bool Load()
170172
{
171-
byte[] data = store.TryGet(ConsensusStateKey);
173+
byte[] data = store?.TryGet(ConsensusStateKey);
172174
if (data is null || data.Length == 0) return false;
173175
MemoryReader reader = new(data);
174176
try
@@ -272,7 +274,7 @@ public void Reset(byte viewNumber)
272274

273275
public void Save()
274276
{
275-
store.PutSync(ConsensusStateKey, this.ToArray());
277+
store?.PutSync(ConsensusStateKey, this.ToArray());
276278
}
277279

278280
public void Deserialize(ref MemoryReader reader)

0 commit comments

Comments
 (0)