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

feat(chain)!: Add time_of_sync to SyncRequest and FullScanRequest WIP #1566

Closed
wants to merge 2 commits into from

Conversation

LagginTimes
Copy link
Contributor

@LagginTimes LagginTimes commented Aug 21, 2024

Implements #1550.

Description

Adds time_of_sync as a member of SyncRequest and FullSyncRequest so we can set the last_seen for unconfirmed transactions during the sync/scan process in bdk_electrum.

Notes to the reviewers

This PR is a WIP because setting the last_seen for unconfirmed transactions during the sync/scan process is yet to be implemented for bdk_esplora. I pushed my WIP towards setting the last_seen for bdk_esplora but I'm unsure if it is correct, as I did not have enough time to confirm and write a test for it before my travel. Please feel free to drop that commit if the concept is incorrect.

Changelog notice

  • Removed update_last_seen_unconfirmed() from TxGraph.
  • Added time_of_sync as a member of SyncRequest.
  • Added time_of_sync as a member of FullScanRequest.

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature

Sorry, something went wrong.

@LagginTimes LagginTimes marked this pull request as draft August 21, 2024 17:53
@LagginTimes LagginTimes force-pushed the time_of_sync branch 2 times, most recently from 47d602e to 806b99b Compare August 21, 2024 18:28
@notmandatory notmandatory added this to the 1.0.0-beta milestone Aug 21, 2024
@notmandatory notmandatory added the new feature New feature or request label Aug 21, 2024
Comment on lines -616 to -637
pub fn update_last_seen_unconfirmed(&mut self, seen_at: u64) -> ChangeSet<A> {
let mut changeset = ChangeSet::default();
let unanchored_txs: Vec<Txid> = self
.txs
.iter()
.filter_map(
|(&txid, (_, anchors))| {
if anchors.is_empty() {
Some(txid)
} else {
None
}
},
)
.collect();

for txid in unanchored_txs {
changeset.merge(self.insert_seen_at(txid, seen_at));
}
changeset
}

Copy link
Member

Choose a reason for hiding this comment

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

I think removing this method should really be a separate commit. However, I'm wondering if there is an argument to keep it.

Copy link
Member

Choose a reason for hiding this comment

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

My 2 sats is if both wallet and non-wallet based app will use SyncRequest and FullScanRequest then this shouldn't be needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module-blockchain new feature New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants