Skip to content

Commit

Permalink
update onpersist and oncommit (neo-project#461)
Browse files Browse the repository at this point in the history
* update method

* More fixes

Co-authored-by: Erik Zhang <[email protected]>
  • Loading branch information
2 people authored and joeqian10 committed Apr 7, 2021
1 parent 2cc5f87 commit 527b5c6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
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

0 comments on commit 527b5c6

Please sign in to comment.