-
Notifications
You must be signed in to change notification settings - Fork 329
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
rename scan to scan_with_keychain #1117
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few comments. Tests are failing, check the CI logs :)
I have made some changes, a review is most welcome. |
You have a few conflicts, rebase on master to fix them |
Sorry about that. I have fixed the conflicts |
…trumExt` no longer takes `txids` and `outpoints` as arguments Fix: `example_electrum` and `wallet_electrum` in `example-crates` no longer take values for these arguments that implement the `scan` method of trait `ElectrumExt`
…ethod `scan` to `scan_with_keychain` BREAKING CHANGE: In `electrum` crate rename the `ElectrumExt` trait method `scan_without_keychain` to `sync` Fix: Modify the `example_electrum` and `wallet_electrum` examples to use new methods from `ElectrumExt` trait
Chore: Implement recommendations from cargo clippy
…ethod `scan` to `scan_with_keychain` BREAKING CHANGE: In `electrum` crate rename the `ElectrumExt` trait method `scan_without_keychain` to `sync` Fix: Modify the `example_electrum` and `wallet_electrum` examples to use new methods from `ElectrumExt` trait This commit has been rebased to use commits at hash `c20a4da9fc902a062eb217b39e37a32d9e64a148` The requested updates have been applied using this commits and previous commits are mostly outdated
@@ -836,7 +836,7 @@ mod test { | |||
let drain_script = ScriptBuf::default(); | |||
let target_amount = 250_000 + FEE_AMOUNT; | |||
|
|||
let result = LargestFirstCoinSelection::default() | |||
let result = LargestFirstCoinSelection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these changes on coin selection slipped in because of the rebase. You have to remove them. There is more other files. Just cross check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes were as a result of running clippy. If you run clippy on master you will get recommendations to remove them. Since in rust tuple struct LargestFirstCoinSelection
you dont need to call ::default()
to initialize it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally it's better to handle fixing clippy changes in a separate commit or PR to make the review easier. Also a nit on commit messages, instead of BREAKING CHANGE:
I'd use the notation refactor!(<module name>): ...
. See: https://www.conventionalcommits.org/en/v1.0.0/
And as @LLFourn mentioned we may end up incorporating this rename into another PR but if you have time it wouldn't hurt to fix this one up in case we can use it.
txids: impl IntoIterator<Item = Txid>, | ||
outpoints: impl IntoIterator<Item = OutPoint>, | ||
_txids: impl IntoIterator<Item = Txid>, | ||
_outpoints: impl IntoIterator<Item = OutPoint>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why don't we completely remove _txids
and _outpoints
? I don't see their utility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are used in bdk/example-crates/example_electrum/src/main.rs
line 249, do I remove the code in examples too to reflect this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
txids
and outpoints
is meant to return you any relevant transactions to these items. They can't just be _ignored
. A more significant refactoring is needed so that this method does not call scan_with_keychain
but implements its own scanning logic.
&self, | ||
prev_tip: Option<CheckPoint>, | ||
keychain_spks: BTreeMap<K, impl IntoIterator<Item = (u32, ScriptBuf)>>, | ||
txids: impl IntoIterator<Item = Txid>, | ||
outpoints: impl IntoIterator<Item = OutPoint>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we are removing txids
and outpoints
it doesn't make sense to be calling populate_with_txids
and populate_with_outpoints
here. Should separate methods be created to get these updates? @LLFourn @evanlinjin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes the separate method is scan
. scan
is still meant to be doing this.
I will fix doc issues ASAP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure that all your commits are clean, and that don't introduce changes that you later undo in newer commits. For example, 2fa5fc6 introduces a couple of unwanted "<<<<<<< HEAD" that you later remove in 2a9a2e0 - instead, squash the two commits together.
Regarding commit messages:
- We use conventional commits (https://www.conventionalcommits.org/en/v1.0.0/), which use the
!
in the commit title to signal breaking changes (https://www.conventionalcommits.org/en/v1.0.0/#commit-message-with--to-draw-attention-to-breaking-change). Also, we don't put "In ... crate", we simply put "name of the crate:" at the start of the title. As an example, 7e91849's title should go from:
BREAKING CHANGE: In electrum crate the method scan of trait `Elec…
…trumExt` no longer takes `txids` and `outpoints` as arguments
to:
refactor(electrum)!: `ElectrumExt::scan` no longer takes `txids`, `outpoints`
Notice that the part before :
is in lowercase characters, and the part after :
is capitalized.
9655e31's now looks like this:
Chore: Run cargo fmt
instead, it should be:
chore: Run cargo clippy
Since you're running clippy and not fmt :) Also, if the commit title is explanatory enough, you don't have to write a commit message.
If you've never rewritten commit messages, this can be of help: https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History
…scan_with_keychain` This solves the issue where CI tests for docs.rs error on rustdoc warning `--cfg docsrs -Dwarnings`
Thanks. I will look into commit messages |
Hey @448-OG, are you still working on this? Do you need help with anything? |
Hey @danielabrozzoni I had finished doing changes, there were some comments @vladimirfomene made that I commented on. Unless there are new changes requested, my PR is ready for review |
After today's discussion in the Lib Team Call, a check on whether all the comments were addressed is needed on this PR. Also it will probably need to be rebased after the ci fix of #1182 |
My opinion is that we probably want to close this PR in favor of one that solves all the problems in #1195 at once. |
Thanks for the opportunity and reviews I got, I learnt quite a few things about the library. |
The purpose of this PR is to make changes regarding issue #1112
Notes to the reviewers
This is a draft pull request
Checklists
All Submissions:
cargo fmt
andcargo clippy
before committingBugfixes:
cargo test --all-features