Generalize add_recipient to accept Address#1841
Generalize add_recipient to accept Address#1841ValuedMammal merged 1 commit intobitcoindevkit:masterfrom
add_recipient to accept Address#1841Conversation
|
Concept ACK, I guess the same could be done for |
|
That change would require a For 2.0.0, I would consider adding a |
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 |
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 |
3bb94e4 to
de2c44f
Compare
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
ScriptBufinTxBuilder::add_recipientChecklists
All Submissions:
cargo fmtandcargo clippybefore committingNew Features:
Bugfixes: