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

Prioritise unused change addresses for split #85

Merged
merged 2 commits into from
Feb 16, 2022

Conversation

nickfarrow
Copy link
Collaborator

Alleviates #66
Based on #81
Unused change addresses are used first (searched from index 0 up to and including last_unused), and then fill rest of outputs with new addresses. Only creates one new change address in best case.

@nickfarrow nickfarrow force-pushed the splitunused branch 2 times, most recently from c22b931 to 34ccefb Compare February 9, 2022 23:35
@nickfarrow nickfarrow changed the base branch from v0.6-release to v0.6-fixups2 February 9, 2022 23:45
@LLFourn LLFourn deleted the branch GoUpNumber:v0.6-release February 9, 2022 23:48
@LLFourn LLFourn closed this Feb 9, 2022
@LLFourn LLFourn reopened this Feb 9, 2022
@LLFourn LLFourn changed the base branch from v0.6-fixups2 to v0.6-release February 9, 2022 23:54
@nickfarrow nickfarrow marked this pull request as ready for review February 10, 2022 01:38
@@ -579,7 +636,7 @@ pub fn run_split_cmd(wallet: &GunWallet, opt: SplitOpt) -> anyhow::Result<CmdOut
// add one recipient so we at least get one split utxo of the correct size.
.add_recipient(
bdk_wallet
.get_change_address(AddressIndex::New)?
.get_change_address(AddressIndex::LastUnused)?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm so this bit doesn't fix the underlying problem with split_change. Perhaps for now the best thing to do is to make the number of outputs mandatory so we don't have to use split_change.

After this is merged we should make a PR to BDK adding FirstUnused and batch address fetch to BDK and maybe introduce split_change with that.

@LLFourn LLFourn merged commit eb89884 into GoUpNumber:v0.6-release Feb 16, 2022
LLFourn added a commit that referenced this pull request Feb 16, 2022
* prioritise unused change addresses for split

* Fix clippy warnings

Co-authored-by: LLFourn <lloyd.fourn@gmail.com>
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.

None yet

2 participants