Remove optional return types from session history methods#1055
Remove optional return types from session history methods#1055arminsabouri merged 1 commit intopayjoin:masterfrom
Conversation
04bdd8b to
5a023db
Compare
Pull Request Test Coverage Report for Build 17649247435Details
💛 - Coveralls |
b08b9b3 to
f717451
Compare
f717451 to
efa381c
Compare
There was a problem hiding this comment.
Thanks for creating a clean diff! This was easy to review. I have one issue with a comment that was changed.
Besides that we should remove default impl from SessionHistory and replace it with a pub(crate) new method which accepts a non-empty iter of session events. Otherwise we could have a builder pattern but that may be overkill. Lmk what you think.
Point being the application should not have the visibility to create an instance of SessionHistory. It can only be obtained by replaying events -- which guarantees that we have at least one event.
48c096a to
2a1875d
Compare
looks good to me as this prevents a scenerio where |
41098ce to
5a3c9d0
Compare
arminsabouri
left a comment
There was a problem hiding this comment.
Code ACK
Just one more case of the same rustdoc being modified
payjoin-ffi/src/send/mod.rs
Outdated
| pub fn fallback_tx(&self) -> Option<Arc<crate::Transaction>> { | ||
| self.0.fallback_tx().map(|tx| Arc::new(tx.into())) | ||
| } | ||
| /// Fallback transaction from the session |
There was a problem hiding this comment.
Another case of the same comment being modified. Must have missed this in my first review.
| /// Fallback transaction from the session | |
| /// Fallback transaction from the session if present |
- Update sender methods & receiver methods to return non-optional types - Add `expect()` calls with descriptive messages for safety fix: update expect messages to use session event log refactor: move Some() wrapping into unwrap_relay_or_else_fetch revert: restore original comment to fit logic update comment back to previous state
80578fc to
1d39b90
Compare
thank you @arminsabouri |
|
I'm somewhat skeptical of these methods on SessionHistory at all. It seems like let pj_uri = session_history.pj_uri().extras.endpoint().clone();
let ohttp_relay = self.unwrap_relay_or_else_fetch(Some(pj_uri)).await?;
self.handle_recoverable_error(&ohttp_relay, &session_history).await?; |
|
My comment is not blocking merge tho |
OH1H The fact that its not used is indicative that the refrence is incomplete and once we complete it we may find that we dont need exact method of |
After PR #1014 removes the Uninitialized variant and enforces that every SEL must contain at least one event, session history methods no longer need to return
Option<T>since it guarantee's data availabilityChanges
fallback_tx()andpj_param()now return non-optional typespj_uri()andsession_context()now return non-optional typesCloses #1046
Pull Request Checklist
Please confirm the following before requesting review:
AI
in the body of this PR.