-
Notifications
You must be signed in to change notification settings - Fork 354
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
Generalize add_recipient
to accept Address
#1841
base: master
Are you sure you want to change the base?
Conversation
Concept ACK, I guess the same could be done for |
That change would require a For 2.0.0, I would consider adding a |
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.
ACK 3bb94e4
Why would that change require a pub fn set_recipients(
&mut self,
recipients: impl IntoIterator<Item = (impl Into<ScriptBuf>, Amount)>,
) -> &mut Self {
self.params.recipients = recipients
.into_iter()
.map(|(spk, amount)| (spk.into(), amount))
.collect();
self
} The only problem with this is that it will be a breaking change because the compiler needs to know the explicit type of |
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.
ACK 3bb94e4
I was thinking dynamic dispatch would be required, but it is cool to see that is not the case. Good catch on the potentially missing annotations in |
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.
utACK 3bb94e4
Description
I would imagine many users would be handling a
Address<NetworkChecked>
when building a transaction. They may pass this structure directly with this patch, or continue to useScriptBuf
.Notes to the reviewers
To my knowledge this is non-breaking, but it is a change in the function signature so I am not sure.
Changelog notice
Accept any type that is convertible to a
ScriptBuf
inTxBuilder::add_recipient
Checklists
All Submissions:
cargo fmt
andcargo clippy
before committingNew Features:
Bugfixes: