Payjoin-cli should cache ohttp-keys for re-use#1035
Open
zealsham wants to merge 1 commit intopayjoin:masterfrom
Open
Payjoin-cli should cache ohttp-keys for re-use#1035zealsham wants to merge 1 commit intopayjoin:masterfrom
zealsham wants to merge 1 commit intopayjoin:masterfrom
Conversation
Collaborator
Pull Request Test Coverage Report for Build 19678524663Details
💛 - Coveralls |
27c936f to
8512a28
Compare
0b94117 to
3744b03
Compare
zealsham
commented
Sep 26, 2025
| relay_manager: Arc<Mutex<RelayManager>>, | ||
| ) -> Result<ValidatedOhttpKeys> { | ||
| println!("before first some"); | ||
| if let Some(ohttp_keys) = config.v2()?.ohttp_keys.clone() { |
Collaborator
Author
There was a problem hiding this comment.
oops! , println statements i used for debugging got commited accidentally , cleaning it up
3744b03 to
0fe2229
Compare
Collaborator
|
@zealsham I am going to mark this as draft. Do you mind cleaning up the commit messages and history and re-opening. Thank you. |
d664164 to
971c8d3
Compare
This pr adds the functionality of ohttp-keys catching to payjoin-cli , ohttp-keys should not be fetched each time and a cached key should be use. Keys expire in 6 months .
971c8d3 to
2198e3f
Compare
Collaborator
Author
|
@arminsabouri the PR is ready |
arminsabouri
reviewed
Dec 1, 2025
|
|
||
| // try cache for this selected relay first | ||
| if let Some(cached) = read_cached_ohttp_keys(&selected_relay) { | ||
| println!("using Cached keys for relay: {selected_relay}"); |
Collaborator
There was a problem hiding this comment.
Can we use the logger instead of println?
|
|
||
| // try cache for this selected relay first | ||
| if let Some(cached) = read_cached_ohttp_keys(&selected_relay) { | ||
| println!("using Cached keys for relay: {selected_relay}"); |
Collaborator
There was a problem hiding this comment.
Suggested change
| println!("using Cached keys for relay: {selected_relay}"); | |
| println!("using Cached keys for relay: {selected_relay}"); |
| // try cache for this selected relay first | ||
| if let Some(cached) = read_cached_ohttp_keys(&selected_relay) { | ||
| println!("using Cached keys for relay: {selected_relay}"); | ||
| if !is_expired(&cached) && cached.relay_url == selected_relay { |
Collaborator
There was a problem hiding this comment.
Why would read_cached_ohttp_keys return an expired or keys for a different relay? Perphaps read_cached_ohttp_keys should return ValidateOhttpKeys?
| fetched_at: u64, | ||
| } | ||
|
|
||
| fn get_cache_file(relay_url: &url::Url) -> PathBuf { |
Collaborator
There was a problem hiding this comment.
Why are cached keys not being persisted in the database?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pr adds the functionality of ohttp-keys catching to payjoin-cli , ohttp-keys should not be fetched each time and a cached key should be use. Keys expire in 6 months .
To do
Pull Request Checklist
Please confirm the following before requesting review:
AI
in the body of this PR.