Skip to content

Commit f8a9478

Browse files
committed
witness script -> explicit script
1 parent ac42ed3 commit f8a9478

File tree

7 files changed

+22
-22
lines changed

7 files changed

+22
-22
lines changed

examples/htlc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ fn main() {
6060
);
6161

6262
assert_eq!(
63-
format!("{:x}", htlc_descriptor.witness_script(NullCtx)),
63+
format!("{:x}", htlc_descriptor.explicit_script(NullCtx)),
6464
"21022222222222222222222222222222222222222222222222222222222222222222ac6476a91451814f108670aced2d77c1805ddd6634bc9d473188ad025c11b26782012088a82011111111111111111111111111111111111111111111111111111111111111118768"
6565
);
6666

examples/parse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn main() {
4242
);
4343

4444
assert_eq!(
45-
format!("{:x}", my_descriptor.witness_script(NullCtx)),
45+
format!("{:x}", my_descriptor.explicit_script(NullCtx)),
4646
"21020202020202020202020202020202020202020202020202020202020202020202ac"
4747
);
4848
}

examples/sign_multisig.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ fn main() {
100100
);
101101

102102
assert_eq!(
103-
format!("{:x}", my_descriptor.witness_script(NullCtx)),
103+
format!("{:x}", my_descriptor.explicit_script(NullCtx)),
104104
"52\
105105
21020202020202020202020202020202020202020202020202020202020202020202\
106106
21020102030405060708010203040506070801020304050607080000000000000000\

src/descriptor/bare.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ where
136136
Script::new()
137137
}
138138

139-
fn witness_script<ToPkCtx: Copy>(&self, to_pk_ctx: ToPkCtx) -> Script
139+
fn explicit_script<ToPkCtx: Copy>(&self, to_pk_ctx: ToPkCtx) -> Script
140140
where
141141
Pk: ToPublicKey<ToPkCtx>,
142142
{
@@ -306,7 +306,7 @@ where
306306
Script::new()
307307
}
308308

309-
fn witness_script<ToPkCtx: Copy>(&self, to_pk_ctx: ToPkCtx) -> Script
309+
fn explicit_script<ToPkCtx: Copy>(&self, to_pk_ctx: ToPkCtx) -> Script
310310
where
311311
Pk: ToPublicKey<ToPkCtx>,
312312
{

src/descriptor/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ pub trait DescriptorTrait<Pk: MiniscriptKey> {
139139
/// would be [NullCtx] and [descriptor.DescriptorPublicKeyCtx] if MiniscriptKey is [descriptor.DescriptorPublicKey]
140140
///
141141
/// In general, this is defined by generic for the trait [ToPublicKey]
142-
fn witness_script<ToPkCtx: Copy>(&self, to_pk_ctx: ToPkCtx) -> Script
142+
fn explicit_script<ToPkCtx: Copy>(&self, to_pk_ctx: ToPkCtx) -> Script
143143
where
144144
Pk: ToPublicKey<ToPkCtx>;
145145

@@ -466,16 +466,16 @@ where
466466
/// would be [NullCtx](crate::NullCtx) and [DescriptorPublicKeyCtx] if MiniscriptKey is [DescriptorPublicKey]
467467
///
468468
/// In general, this is defined by generic for the trait [ToPublicKey]
469-
fn witness_script<ToPkCtx: Copy>(&self, to_pk_ctx: ToPkCtx) -> Script
469+
fn explicit_script<ToPkCtx: Copy>(&self, to_pk_ctx: ToPkCtx) -> Script
470470
where
471471
Pk: ToPublicKey<ToPkCtx>,
472472
{
473473
match *self {
474-
Descriptor::Bare(ref bare) => bare.witness_script(to_pk_ctx),
475-
Descriptor::Pkh(ref pkh) => pkh.witness_script(to_pk_ctx),
476-
Descriptor::Wpkh(ref wpkh) => wpkh.witness_script(to_pk_ctx),
477-
Descriptor::Wsh(ref wsh) => wsh.witness_script(to_pk_ctx),
478-
Descriptor::Sh(ref sh) => sh.witness_script(to_pk_ctx),
474+
Descriptor::Bare(ref bare) => bare.explicit_script(to_pk_ctx),
475+
Descriptor::Pkh(ref pkh) => pkh.explicit_script(to_pk_ctx),
476+
Descriptor::Wpkh(ref wpkh) => wpkh.explicit_script(to_pk_ctx),
477+
Descriptor::Wsh(ref wsh) => wsh.explicit_script(to_pk_ctx),
478+
Descriptor::Sh(ref sh) => sh.explicit_script(to_pk_ctx),
479479
}
480480
}
481481

@@ -1134,7 +1134,7 @@ mod tests {
11341134
#[test]
11351135
fn after_is_cltv() {
11361136
let descriptor = Descriptor::<bitcoin::PublicKey>::from_str("wsh(after(1000))").unwrap();
1137-
let script = descriptor.witness_script(NullCtx);
1137+
let script = descriptor.explicit_script(NullCtx);
11381138

11391139
let actual_instructions: Vec<_> = script.instructions().collect();
11401140
let check = actual_instructions.last().unwrap();
@@ -1145,7 +1145,7 @@ mod tests {
11451145
#[test]
11461146
fn older_is_csv() {
11471147
let descriptor = Descriptor::<bitcoin::PublicKey>::from_str("wsh(older(1000))").unwrap();
1148-
let script = descriptor.witness_script(NullCtx);
1148+
let script = descriptor.explicit_script(NullCtx);
11491149

11501150
let actual_instructions: Vec<_> = script.instructions().collect();
11511151
let check = actual_instructions.last().unwrap();

src/descriptor/segwitv0.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ where
174174
where
175175
Pk: ToPublicKey<ToPkCtx>,
176176
{
177-
self.witness_script(to_pk_ctx).to_v0_p2wsh()
177+
self.explicit_script(to_pk_ctx).to_v0_p2wsh()
178178
}
179179

180180
fn unsigned_script_sig<ToPkCtx: Copy>(&self, _to_pk_ctx: ToPkCtx) -> Script
@@ -184,7 +184,7 @@ where
184184
Script::new()
185185
}
186186

187-
fn witness_script<ToPkCtx: Copy>(&self, to_pk_ctx: ToPkCtx) -> Script
187+
fn explicit_script<ToPkCtx: Copy>(&self, to_pk_ctx: ToPkCtx) -> Script
188188
where
189189
Pk: ToPublicKey<ToPkCtx>,
190190
{
@@ -208,7 +208,7 @@ where
208208
WshInner::SortedMulti(ref smv) => smv.satisfy(satisfier, to_pk_ctx)?,
209209
WshInner::Ms(ref ms) => ms.satisfy(satisfier, to_pk_ctx)?,
210210
};
211-
witness.push(self.witness_script(to_pk_ctx).into_bytes());
211+
witness.push(self.explicit_script(to_pk_ctx).into_bytes());
212212
let script_sig = Script::new();
213213
Ok((witness, script_sig))
214214
}
@@ -239,7 +239,7 @@ where
239239
where
240240
Pk: ToPublicKey<ToPkCtx>,
241241
{
242-
self.witness_script(to_pk_ctx)
242+
self.explicit_script(to_pk_ctx)
243243
}
244244
}
245245

@@ -387,7 +387,7 @@ where
387387
Script::new()
388388
}
389389

390-
fn witness_script<ToPkCtx: Copy>(&self, to_pk_ctx: ToPkCtx) -> Script
390+
fn explicit_script<ToPkCtx: Copy>(&self, to_pk_ctx: ToPkCtx) -> Script
391391
where
392392
Pk: ToPublicKey<ToPkCtx>,
393393
{

src/descriptor/sh.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ where
238238
{
239239
match self.inner {
240240
ShInner::Wsh(ref wsh) => {
241-
let witness_script = wsh.witness_script(to_pk_ctx);
241+
let witness_script = wsh.explicit_script(to_pk_ctx);
242242
script::Builder::new()
243243
.push_slice(&witness_script.to_v0_p2wsh()[..])
244244
.into_script()
@@ -253,12 +253,12 @@ where
253253
}
254254
}
255255

256-
fn witness_script<ToPkCtx: Copy>(&self, to_pk_ctx: ToPkCtx) -> Script
256+
fn explicit_script<ToPkCtx: Copy>(&self, to_pk_ctx: ToPkCtx) -> Script
257257
where
258258
Pk: ToPublicKey<ToPkCtx>,
259259
{
260260
match self.inner {
261-
ShInner::Wsh(ref wsh) => wsh.witness_script(to_pk_ctx),
261+
ShInner::Wsh(ref wsh) => wsh.explicit_script(to_pk_ctx),
262262
ShInner::Wpkh(ref wpkh) => wpkh.script_pubkey(to_pk_ctx),
263263
ShInner::SortedMulti(ref smv) => smv.encode(to_pk_ctx),
264264
ShInner::Ms(ref ms) => ms.encode(to_pk_ctx),

0 commit comments

Comments
 (0)