Skip to content

Commit 0efabf9

Browse files
committed
Rename stackelem to stack_elem
We have non-uniform function names, sometimes 'stackelem' is used and sometimes 'stack_elem'. Be uniform and conventional, use 'stack_elem' in function names.
1 parent 104eb55 commit 0efabf9

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/interpreter/inner.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fn pk_from_slice(slice: &[u8], require_compressed: bool) -> Result<bitcoin::Publ
3535
}
3636
}
3737

38-
fn pk_from_stackelem(
38+
fn pk_from_stack_elem(
3939
elem: &stack::Element<'_>,
4040
require_compressed: bool,
4141
) -> Result<bitcoin::PublicKey, Error> {
@@ -49,7 +49,7 @@ fn pk_from_stackelem(
4949

5050
// Parse the script with appropriate context to check for context errors like
5151
// correct usage of x-only keys or multi_a
52-
fn script_from_stackelem<Ctx: ScriptContext>(
52+
fn script_from_stack_elem<Ctx: ScriptContext>(
5353
elem: &stack::Element<'_>,
5454
) -> Result<Miniscript<Ctx::Key, Ctx>, Error> {
5555
match *elem {
@@ -141,7 +141,7 @@ pub(super) fn from_txdata<'txin>(
141141
} else {
142142
match ssig_stack.pop() {
143143
Some(elem) => {
144-
let pk = pk_from_stackelem(&elem, false)?;
144+
let pk = pk_from_stack_elem(&elem, false)?;
145145
if *spk == bitcoin::Script::new_p2pkh(&pk.to_pubkeyhash().into()) {
146146
Ok((
147147
Inner::PublicKey(pk.into(), PubkeyType::Pkh),
@@ -162,7 +162,7 @@ pub(super) fn from_txdata<'txin>(
162162
} else {
163163
match wit_stack.pop() {
164164
Some(elem) => {
165-
let pk = pk_from_stackelem(&elem, true)?;
165+
let pk = pk_from_stack_elem(&elem, true)?;
166166
if *spk == bitcoin::Script::new_v0_p2wpkh(&pk.to_pubkeyhash().into()) {
167167
Ok((
168168
Inner::PublicKey(pk.into(), PubkeyType::Wpkh),
@@ -183,7 +183,7 @@ pub(super) fn from_txdata<'txin>(
183183
} else {
184184
match wit_stack.pop() {
185185
Some(elem) => {
186-
let miniscript = script_from_stackelem::<Segwitv0>(&elem)?;
186+
let miniscript = script_from_stack_elem::<Segwitv0>(&elem)?;
187187
let script = miniscript.encode();
188188
let miniscript = miniscript.to_no_checks_ms();
189189
let scripthash = sha256::Hash::hash(&script[..]);
@@ -233,7 +233,7 @@ pub(super) fn from_txdata<'txin>(
233233
let tap_script = wit_stack.pop().ok_or(Error::UnexpectedStackEnd)?;
234234
let ctrl_blk =
235235
ControlBlock::from_slice(ctrl_blk).map_err(Error::ControlBlockParse)?;
236-
let tap_script = script_from_stackelem::<Tap>(&tap_script)?;
236+
let tap_script = script_from_stack_elem::<Tap>(&tap_script)?;
237237
let ms = tap_script.to_no_checks_ms();
238238
// Creating new contexts is cheap
239239
let secp = bitcoin::secp256k1::Secp256k1::verification_only();
@@ -274,7 +274,7 @@ pub(super) fn from_txdata<'txin>(
274274
if !ssig_stack.is_empty() {
275275
Err(Error::NonEmptyScriptSig)
276276
} else {
277-
let pk = pk_from_stackelem(&elem, true)?;
277+
let pk = pk_from_stack_elem(&elem, true)?;
278278
if slice
279279
== &bitcoin::Script::new_v0_p2wpkh(
280280
&pk.to_pubkeyhash().into(),
@@ -302,7 +302,7 @@ pub(super) fn from_txdata<'txin>(
302302
Err(Error::NonEmptyScriptSig)
303303
} else {
304304
// parse wsh with Segwitv0 context
305-
let miniscript = script_from_stackelem::<Segwitv0>(&elem)?;
305+
let miniscript = script_from_stack_elem::<Segwitv0>(&elem)?;
306306
let script = miniscript.encode();
307307
let miniscript = miniscript.to_no_checks_ms();
308308
let scripthash = sha256::Hash::hash(&script[..]);
@@ -324,7 +324,7 @@ pub(super) fn from_txdata<'txin>(
324324
}
325325
}
326326
// normal p2sh parsed in Legacy context
327-
let miniscript = script_from_stackelem::<Legacy>(&elem)?;
327+
let miniscript = script_from_stack_elem::<Legacy>(&elem)?;
328328
let script = miniscript.encode();
329329
let miniscript = miniscript.to_no_checks_ms();
330330
if wit_stack.is_empty() {

0 commit comments

Comments
 (0)