Skip to content

Commit

Permalink
Fix test, fix whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
damian-orzechowski committed Nov 28, 2024
1 parent c7232ef commit 336238a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/Paprika.Tests/Chain/RawStateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public async Task Metadata_are_preserved()
raw.Commit(keepOpened: true);

raw.SetAccount(c, new Account(valueC, valueC));
raw.Commit(keepOpened:true);
raw.Commit(keepOpened: true);

var root = raw.Hash;

Expand Down Expand Up @@ -143,10 +143,10 @@ public async Task DeleteByShortPrefix()

raw.SetAccount(account1, new Account(1, 1));
raw.SetAccount(account2, new Account(2, 2));
raw.Commit();
raw.Commit(keepOpened: true);

raw.RegisterDeleteByPrefix(Key.Account(NibblePath.FromKey(account2).SliceTo(1)));
raw.Commit();
raw.Commit(keepOpened: true);

raw.Finalize(1);

Expand All @@ -159,10 +159,10 @@ public async Task DeleteByShortPrefix()
using var raw2 = blockchain.StartRaw();

raw2.SetAccount(account2, new Account(2, 2));
raw2.Commit();
raw2.Commit(keepOpened: true);

raw2.RegisterDeleteByPrefix(Key.Account(NibblePath.Empty));
raw2.Commit();
raw2.Commit(keepOpened: true);

raw2.Finalize(2);

Expand All @@ -186,13 +186,13 @@ public void DeleteByPrefixStorage()

raw.SetAccount(account, new Account(1, 1));
raw.SetStorage(account, Values.Key2, new byte[] { 1, 2, 3, 4, 5 });
raw.Commit();
raw.Commit(keepOpened: true);

using var read = db.BeginReadOnlyBatch();
read.TryGet(Key.StorageCell(NibblePath.FromKey(account), Values.Key2), out _).Should().BeTrue();

raw.RegisterDeleteByPrefix(Key.StorageCell(NibblePath.FromKey(account), NibblePath.Empty));
raw.Commit();
raw.Commit(keepOpened: true);

raw.Finalize(1);

Expand Down
2 changes: 1 addition & 1 deletion src/Paprika/Chain/Blockchain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2165,7 +2165,7 @@ public void Commit(bool ensureHash, bool keepOpened)
//commit without hash recalc - useful for storage ranges in snap sync
if (ensureHash)
Hash = _current.Hash;

using var batch = _db.BeginNextBatch();

DeleteByPrefixes(batch);
Expand Down

0 comments on commit 336238a

Please sign in to comment.