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

Real-time Sync: Add push logic and run method #568

Open
wants to merge 6 commits into
base: yse-rt-merge
Choose a base branch
from

Conversation

hydra-yse
Copy link
Collaborator

@hydra-yse hydra-yse commented Nov 16, 2024

Based on #555 and #556.
Closes #504, closes #505.

TODO:

  • Add unit tests

@hydra-yse hydra-yse self-assigned this Nov 16, 2024
lib/core/src/sync/mod.rs Outdated Show resolved Hide resolved
lib/core/src/sync/mod.rs Outdated Show resolved Hide resolved
lib/core/src/sync/mod.rs Outdated Show resolved Hide resolved
lib/core/src/sync/mod.rs Outdated Show resolved Hide resolved
lib/core/src/sync/mod.rs Outdated Show resolved Hide resolved
lib/core/src/sync/mod.rs Outdated Show resolved Hide resolved
Copy link
Member

@roeierez roeierez 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, some small comments.

lib/core/src/persist/chain.rs Show resolved Hide resolved
lib/core/src/sync/mod.rs Outdated Show resolved Hide resolved
@@ -316,6 +324,11 @@ impl Persister {
},
)?;

let updated_fields = get_updated_fields!(mrh_tx_id, mrh_amount_sat);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Both these fields are recovered in the sync, so is this needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, not anymore 👍

}
}

pub(crate) async fn run(self: Arc<Self>, mut shutdown: watch::Receiver<()>) -> Result<()> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shall we call it start() for consistency?

Copy link
Collaborator Author

@hydra-yse hydra-yse Nov 28, 2024

Choose a reason for hiding this comment

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

Handled in next PR (#578)

Copy link
Collaborator

@dangeross dangeross left a comment

Choose a reason for hiding this comment

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

ACK


// Clean incoming
let record = Record::new(
SyncData::Receive(new_receive_sync_data(None, None)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
SyncData::Receive(new_receive_sync_data(None, None)),
SyncData::Receive(new_receive_sync_data()),

assert_eq!(incoming_records.len(), 0); // Records have been cleaned

let mut inapplicable_record = Record::new(
SyncData::Receive(new_receive_sync_data(None, None)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
SyncData::Receive(new_receive_sync_data(None, None)),
SyncData::Receive(new_receive_sync_data()),

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.

3 participants