Change ScriptBuf::default to call ScriptBuf::new
What changed, and why it matters
This is a tiny internal code-quality change. It makes the default empty-script constructor reuse the existing `new()` method instead of duplicating the same one-line logic. There is no security bug being fixed and no behavior change for users.
No security action required. Treat as a normal refactoring/review commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch changes ScriptBuf<T>::default() from directly constructing Self(PhantomData, Vec::new()) to calling Self::new(). Both implementations are functionally identical today; the change only enforces the Rust API guideline C-CTOR that Default and new() should stay consistent. No unsafe code, no validation logic, and no observable behavior change are introduced.
Changed components
primitives/src/script/owned.rsScriptBuf<T>::default()Inspect captured patch +1 / −1
diff --git a/primitives/src/script/owned.rs b/primitives/src/script/owned.rs
index 32f2fe36..bd39c385 100644
--- a/primitives/src/script/owned.rs
+++ b/primitives/src/script/owned.rs
@@ -294,7 +294,7 @@ impl<T: ScriptHashableTag> ScriptBuf<T> {
// Cannot derive due to generics.
impl<T> Default for ScriptBuf<T> {
- fn default() -> Self { Self(PhantomData, Vec::new()) }
+ fn default() -> Self { Self::new() }
}
impl<T> Deref for ScriptBuf<T> {
Why this scored 19/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.