Skip to content

Commit 05af218

Browse files
committed
Update decodepsbt for v30
Add the new MuSig2 fields in decodepsbt.
1 parent 35892d4 commit 05af218

File tree

2 files changed

+50
-2
lines changed

2 files changed

+50
-2
lines changed

types/src/v30/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
//! | converttopsbt | version + model | |
129129
//! | createpsbt | version + model | |
130130
//! | createrawtransaction | version + model | |
131-
//! | decodepsbt | version + model | TODO |
131+
//! | decodepsbt | version + model | Musig not modelled: not in rust-bitcoin|
132132
//! | descriptorprocesspsbt | returns boolean | |
133133
//! | decoderawtransaction | version + model | |
134134
//! | decodescript | version + model | |

types/src/v30/raw_transactions/mod.rs

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: CC0-1.0
22

3-
//! The JSON-RPC API for Bitcoin Core `v23` - raw transactions.
3+
//! The JSON-RPC API for Bitcoin Core `v30` - raw transactions.
44
//!
55
//! Types for methods found under the `== Rawtransactions ==` section of the API docs.
66
@@ -78,6 +78,8 @@ pub struct Proprietary {
7878
}
7979

8080
/// An input in a partially signed Bitcoin transaction. Part of `decodepsbt`.
81+
///
82+
/// TODO: Update model once Musig is supported in rust-bitcoin.
8183
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
8284
#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
8385
pub struct PsbtInput {
@@ -121,6 +123,12 @@ pub struct PsbtInput {
121123
pub taproot_internal_key: Option<String>,
122124
/// The hex-encoded Taproot merkle root.
123125
pub taproot_merkle_root: Option<String>,
126+
/// MuSig2 participant public keys.
127+
pub musig2_participant_pubkeys: Option<Vec<Musig2ParticipantPubkeys>>,
128+
/// MuSig2 public nonces.
129+
pub musig2_pubnonces: Option<Vec<Musig2Pubnonce>>,
130+
/// MuSig2 partial signatures.
131+
pub musig2_partial_sigs: Option<Vec<Musig2PartialSig>>,
124132
/// The input proprietary map.
125133
pub proprietary: Option<Vec<Proprietary>>,
126134
/// The unknown input fields.
@@ -143,6 +151,8 @@ pub struct PsbtOutput {
143151
pub taproot_tree: Option<Vec<TaprootLeaf>>,
144152
/// BIP32 derivation paths for keys.
145153
pub taproot_bip32_derivs: Option<Vec<TaprootBip32Deriv>>,
154+
/// MuSig2 participant public keys.
155+
pub musig2_participant_pubkeys: Option<Vec<Musig2ParticipantPubkeys>>,
146156
/// The output proprietary map.
147157
pub proprietary: Option<Vec<Proprietary>>,
148158
/// The unknown global fields.
@@ -201,6 +211,44 @@ pub struct TaprootLeaf {
201211
pub script: String,
202212
}
203213

214+
/// MuSig2 participant public keys. Part of `decodepsbt`.
215+
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
216+
#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
217+
pub struct Musig2ParticipantPubkeys {
218+
/// The compressed aggregate public key for which the participants create.
219+
pub aggregate_pubkey: String,
220+
/// The compressed public keys that are aggregated for aggregate_pubkey.
221+
pub participant_pubkeys: Vec<String>,
222+
}
223+
224+
/// MuSig2 public nonce. Part of `decodepsbt`.
225+
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
226+
#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
227+
pub struct Musig2Pubnonce {
228+
/// The compressed public key of the participant that created this pubnonce.
229+
pub participant_pubkey: String,
230+
/// The compressed aggregate public key for which this pubnonce is for.
231+
pub aggregate_pubkey: String,
232+
/// The hash of the leaf script that contains the aggregate pubkey being signed for. Omitted when signing for the internal key.
233+
pub leaf_hash: Option<String>,
234+
/// The public nonce itself.
235+
pub pubnonce: String,
236+
}
237+
238+
/// MuSig2 partial signature. Part of `decodepsbt`.
239+
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
240+
#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))]
241+
pub struct Musig2PartialSig {
242+
/// The compressed public key of the participant that created this partial signature.
243+
pub participant_pubkey: String,
244+
/// The compressed aggregate public key for which this partial signature is for.
245+
pub aggregate_pubkey: String,
246+
/// The hash of the leaf script that contains the aggregate pubkey being signed for. Omitted when signing for the internal key.
247+
pub leaf_hash: Option<String>,
248+
/// The partial signature itself.
249+
pub partial_sig: String,
250+
}
251+
204252
// TODO: Remove all this code once it is implemented and backported to 0.32.x
205253
// https://github.com/rust-bitcoin/rust-bitcoin/issues/3285
206254
pub mod taproot {

0 commit comments

Comments
 (0)