Skip to content

Commit e8a30bf

Browse files
committed
taproot: Lowercase error messages
By convention error messages should not be capitalised or use full stops. Fix the `taproot` module error messages.
1 parent 717da4b commit e8a30bf

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

bitcoin/src/taproot/mod.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ impl TaprootBuilder {
533533
if let Some(Some(node)) = self.branch.pop() {
534534
Ok(TaprootSpendInfo::from_node_info(secp, internal_key, node))
535535
} else {
536-
unreachable!("Size checked above. Builder guarantees the last element is Some")
536+
unreachable!("size checked above. Builder guarantees the last element is Some")
537537
},
538538
_ => Err(self),
539539
}
@@ -557,7 +557,7 @@ impl TaprootBuilder {
557557

558558
while self.branch.len() == depth as usize + 1 {
559559
let child = match self.branch.pop() {
560-
None => unreachable!("Len of branch checked to be >= 1"),
560+
None => unreachable!("length of branch checked to be >= 1"),
561561
Some(Some(child)) => child,
562562
// Needs an explicit push to add the None that we just popped.
563563
// Cannot use .last() because of borrow checker issues.
@@ -621,9 +621,9 @@ impl core::fmt::Display for IncompleteBuilderError {
621621

622622
f.write_str(match self {
623623
NotFinalized(_) =>
624-
"an attempt to construct a Taproot tree from a builder containing incomplete branches.",
624+
"an attempt to construct a Taproot tree from a builder containing incomplete branches",
625625
HiddenParts(_) =>
626-
"an attempt to construct a Taproot tree from a builder containing hidden parts.",
626+
"an attempt to construct a Taproot tree from a builder containing hidden parts",
627627
})
628628
}
629629
}
@@ -667,7 +667,7 @@ impl core::fmt::Display for HiddenNodesError {
667667

668668
f.write_str(match self {
669669
HiddenParts(_) =>
670-
"an attempt to construct a Taproot tree from a node_info containing hidden parts.",
670+
"an attempt to construct a Taproot tree from a node_info containing hidden parts",
671671
})
672672
}
673673
}
@@ -921,26 +921,26 @@ impl<'de> serde::Deserialize<'de> for NodeInfo {
921921
while let Some(depth) = seq.next_element()? {
922922
let tap_leaf: TapLeaf = seq
923923
.next_element()?
924-
.ok_or_else(|| serde::de::Error::custom("Missing tap_leaf"))?;
924+
.ok_or_else(|| serde::de::Error::custom("missing tap_leaf"))?;
925925
match tap_leaf {
926926
TapLeaf::Script(script, ver) => {
927927
builder =
928928
builder.add_leaf_with_ver(depth, script, ver).map_err(|e| {
929-
serde::de::Error::custom(format!("Leaf insertion error: {}", e))
929+
serde::de::Error::custom(format!("leaf insertion error: {}", e))
930930
})?;
931931
}
932932
TapLeaf::Hidden(h) => {
933933
builder = builder.add_hidden_node(depth, h).map_err(|e| {
934934
serde::de::Error::custom(format!(
935-
"Hidden node insertion error: {}",
935+
"hidden node insertion error: {}",
936936
e
937937
))
938938
})?;
939939
}
940940
}
941941
}
942942
NodeInfo::try_from(builder).map_err(|e| {
943-
serde::de::Error::custom(format!("Incomplete Taproot tree: {}", e))
943+
serde::de::Error::custom(format!("incomplete Taproot tree: {}", e))
944944
})
945945
}
946946
}
@@ -1354,11 +1354,11 @@ impl fmt::Display for TaprootBuilderError {
13541354
}
13551355
OverCompleteTree => write!(
13561356
f,
1357-
"Attempted to create a tree with two nodes at depth 0. There must\
1358-
only be a exactly one node at depth 0",
1357+
"attempted to create a tree with two nodes at depth 0. There must\
1358+
only be exactly one node at depth 0",
13591359
),
13601360
EmptyTree => {
1361-
write!(f, "Called finalize on an empty tree")
1361+
write!(f, "called finalize on an empty tree")
13621362
}
13631363
}
13641364
}

0 commit comments

Comments
 (0)