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

[Improve]: use IReadOnlyStoreView instead. #3683

Merged
merged 17 commits into from
Feb 6, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Feature: use IReadOnlyStoreView when readonly access on storage
  • Loading branch information
nan01ab committed Jan 21, 2025
commit 2014d5c6705b9d7e10431216d3a10f3233d6051e
4 changes: 1 addition & 3 deletions src/Neo/SmartContract/Native/LedgerContract.cs
Original file line number Diff line number Diff line change
@@ -107,9 +107,7 @@ public UInt256 GetBlockHash(IReadOnlyStoreView snapshot, uint index)
throw new ArgumentNullException(nameof(snapshot));

var key = CreateStorageKey(Prefix_BlockHash).AddBigEndian(index);
if (snapshot.TryGet(key, out var item))
return new UInt256(item.Value.Span);
return null;
return snapshot.TryGet(key, out var item) ? new UInt256(item.Value.Span) : null;
}

/// <summary>