From 5f86b3091c8fdda2ca109f8a278f136acc27b076 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 26 Jan 2023 10:28:40 +1100 Subject: [PATCH] Add From
for ScriptBuf Add an implementation of `From
for ScriptBuf` that calls through to `address.script_pubkey` (which calls `address.payload.script_pubkey()`). Fix: #1457 --- bitcoin/src/address.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bitcoin/src/address.rs b/bitcoin/src/address.rs index 5c04b20c..4cfffbb8 100644 --- a/bitcoin/src/address.rs +++ b/bitcoin/src/address.rs @@ -1014,6 +1014,12 @@ impl Address { } } +impl From
for script::ScriptBuf { + fn from(a: Address) -> Self { + a.script_pubkey() + } +} + // Alternate formatting `{:#}` is used to return uppercase version of bech32 addresses which should // be used in QR codes, see [`Address::to_qr_uri`]. impl fmt::Display for Address {