Skip to content

Commit

Permalink
Fix Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
shargon committed Feb 10, 2024
1 parent 561a8dc commit c74a04f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Neo/Persistence/MemorySnapshot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,22 @@ public void Put(byte[] key, byte[] value)

public byte[] TryGet(byte[] key)
{
immutableData.TryGetValue(key, out byte[] value);
if (writeBatch.TryGetValue(key, out byte[] value))
{
return value;
}

immutableData.TryGetValue(key, out value);
return value?[..];
}

public bool Contains(byte[] key)
{
if (writeBatch.TryGetValue(key, out byte[] value) && value != null)
{
return true;
}

return immutableData.ContainsKey(key);
}
}
Expand Down

0 comments on commit c74a04f

Please sign in to comment.