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

Refactor TransactionDetails to include confirmation_time #190

Merged

Conversation

notmandatory
Copy link
Member

@notmandatory notmandatory commented Aug 30, 2022

Description

Fixes #180

Notes to the reviewers

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
  • I've updated CHANGELOG.md

Bugfixes:

  • This pull request breaks the existing API
  • I've added tests to reproduce the issue which are now passing
  • I'm linking the issue being fixed by this PR

@notmandatory notmandatory self-assigned this Aug 30, 2022
@thunderbiscuit thunderbiscuit self-requested a review August 30, 2022 20:11
@notmandatory notmandatory force-pushed the refactor_txdetails branch 2 times, most recently from 81802a2 to 8614d81 Compare August 31, 2022 04:30
@thunderbiscuit
Copy link
Member

@notmandatory is this ready for review or do you still see it as draft? I'll take a look today if it's ready.

@notmandatory notmandatory marked this pull request as ready for review August 31, 2022 12:16
@notmandatory
Copy link
Member Author

It's ready to review!

@ConorOkus ConorOkus added the ldk-compatibility Compatibility with the Lightning Dev Kit label Aug 31, 2022
Copy link
Member

@thunderbiscuit thunderbiscuit left a comment

Choose a reason for hiding this comment

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

Tested ACK. Small typo in the changelog but that's it. 🚀

CHANGELOG.md Outdated Show resolved Hide resolved
@thunderbiscuit
Copy link
Member

Rust-related question: why does confirmation_time here require to be cloned and the others don't?

impl From<&bdk::TransactionDetails> for TransactionDetails {
    fn from(x: &bdk::TransactionDetails) -> TransactionDetails {
        TransactionDetails {
            fee: x.fee,
            txid: x.txid.to_string(),
            received: x.received,
            sent: x.sent,
            confirmation_time: x.confirmation_time.clone(),
        }
    }
}

@notmandatory notmandatory added this to the Release 0.9.0 milestone Sep 5, 2022
@notmandatory
Copy link
Member Author

Rust-related question: why does confirmation_time here require to be cloned and the others don't?

This is because the other types have the Copy trait, meaning they are native types that can be copied into the TransactionDetails automatically. But confirmation_time is a structure that we created so it needs to be explicitly cloned from our reference to the bdk versionbdk::TransactionDetails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ldk-compatibility Compatibility with the Lightning Dev Kit
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Wondering why we use Transaction::Confirmed and Transaction::Unconfirmed
3 participants