Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update onpersist and oncommit #461

Merged
merged 2 commits into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/RpcNep17Tracker/RpcNep17Tracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ private void HandleNotification(StoreView snapshot, IVerifiable scriptContainer,
}
}

public void OnPersist(StoreView snapshot, IReadOnlyList<Blockchain.ApplicationExecuted> applicationExecutedList)
void IPersistencePlugin.OnPersist(Block block, StoreView snapshot, IReadOnlyList<Blockchain.ApplicationExecuted> applicationExecutedList)
{
// Start freshly with a new DBCache for each block.
ResetBatch();
Expand Down Expand Up @@ -192,7 +192,7 @@ public void OnPersist(StoreView snapshot, IReadOnlyList<Blockchain.ApplicationEx
}
}

public void OnCommit(StoreView snapshot)
void IPersistencePlugin.OnCommit(Block block, StoreView snapshot)
{
_balances.Commit();
if (_shouldTrackHistory)
Expand All @@ -204,7 +204,7 @@ public void OnCommit(StoreView snapshot)
_db.Write(WriteOptions.Default, _writeBatch);
}

public bool ShouldThrowExceptionFromCommit(Exception ex)
bool IPersistencePlugin.ShouldThrowExceptionFromCommit(Exception ex)
{
return true;
}
Expand Down
7 changes: 4 additions & 3 deletions src/StatesDumper/StatesDumper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Neo.IO.Caching;
using Neo.IO.Json;
using Neo.Ledger;
using Neo.Network.P2P.Payloads;
using Neo.Persistence;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -49,7 +50,7 @@ private void OnDumpStorage(UInt160 key = null)
: Blockchain.Singleton.View.Storages.Find());
}

public void OnPersist(StoreView snapshot, IReadOnlyList<Blockchain.ApplicationExecuted> applicationExecutedList)
void IPersistencePlugin.OnPersist(Block block, StoreView snapshot, IReadOnlyList<Blockchain.ApplicationExecuted> applicationExecutedList)
{
if (Settings.Default.PersistAction.HasFlag(PersistActions.StorageChanges))
OnPersistStorage(snapshot);
Expand Down Expand Up @@ -96,7 +97,7 @@ private void OnPersistStorage(StoreView snapshot)
}
}

public void OnCommit(StoreView snapshot)
void IPersistencePlugin.OnCommit(Block block, StoreView snapshot)
{
if (Settings.Default.PersistAction.HasFlag(PersistActions.StorageChanges))
OnCommitStorage(snapshot);
Expand All @@ -119,7 +120,7 @@ public void OnCommitStorage(StoreView snapshot)
}
}

public bool ShouldThrowExceptionFromCommit(Exception ex)
bool IPersistencePlugin.ShouldThrowExceptionFromCommit(Exception ex)
{
Console.WriteLine($"Error writing States with StatesDumper.{Environment.NewLine}{ex}");
return true;
Expand Down