Skip to content

feat: Implement DataStore:: get_note_script() for NtxDataStore#1332

Merged
bobbinth merged 10 commits intonextfrom
sergerad-note-script
Nov 4, 2025
Merged

feat: Implement DataStore:: get_note_script() for NtxDataStore#1332
bobbinth merged 10 commits intonextfrom
sergerad-note-script

Conversation

@sergerad
Copy link
Collaborator

@sergerad sergerad commented Nov 4, 2025

Context

Closes #1290.

The NtxDataStore does not currently have an implementation for DataStore::get_note_script().

It can be implemented by using the GetNoteScriptByRoot RPC endpoint.

Changes

  • Implement DataStore::get_note_script() for NtxDataStore using the RPC.
  • Add LRU cache to NtxDataStore.

@sergerad sergerad marked this pull request as ready for review November 4, 2025 04:17
@sergerad sergerad requested review from bobbinth and drahnr November 4, 2025 04:17
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you. I left some comments inline - but the general approach is along the lines of what I was thinking.

///
/// Each cached script contains the deserialized `NoteScript` object, so the actual memory usage
/// depends on the complexity of the scripts being cached.
const DEFAULT_SCRIPT_CACHE_SIZE: usize = 1000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine for now, but we should make this a config parameter in the future. Let's create an issue for this.

@sergerad sergerad requested a review from bobbinth November 4, 2025 20:02
@sergerad sergerad requested a review from bobbinth November 4, 2025 21:16
Copy link
Contributor

@drahnr drahnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you!

@bobbinth bobbinth merged commit de667e9 into next Nov 4, 2025
6 checks passed
@bobbinth bobbinth deleted the sergerad-note-script branch November 4, 2025 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement get_note_script() for NtxDataStore

3 participants