pub struct ScriptAnalyzer<'a> { /* private fields */ }Expand description
Bitcoin script analyzer for comprehensive script analysis
Implementations§
Source§impl<'a> ScriptAnalyzer<'a>
impl<'a> ScriptAnalyzer<'a>
Sourcepub fn complexity_score(&self) -> u32
pub fn complexity_score(&self) -> u32
Calculate script complexity score (higher = more complex)
This score considers:
- Number of opcodes
- Presence of complex operations (crypto, control flow)
- Data push sizes
- Stack depth requirements
Sourcepub fn opcode_count(&self) -> usize
pub fn opcode_count(&self) -> usize
Count the number of opcodes in the script
Sourcepub fn push_count(&self) -> usize
pub fn push_count(&self) -> usize
Count the number of push operations in the script
Sourcepub fn estimate_witness_cost(&self) -> usize
pub fn estimate_witness_cost(&self) -> usize
Estimate the witness cost (weight units) for this script
This is an approximation based on script size and complexity
Sourcepub fn has_risky_opcodes(&self) -> bool
pub fn has_risky_opcodes(&self) -> bool
Check if the script contains any potentially problematic opcodes
Currently checks for commonly disabled opcodes (those between OP_CAT and OP_CODESEPARATOR)
Sourcepub fn script_type(&self) -> ScriptType
pub fn script_type(&self) -> ScriptType
Identify the script type
Sourcepub fn analyze(&self) -> ScriptAnalysis
pub fn analyze(&self) -> ScriptAnalysis
Generate a full analysis report
Auto Trait Implementations§
impl<'a> Freeze for ScriptAnalyzer<'a>
impl<'a> RefUnwindSafe for ScriptAnalyzer<'a>
impl<'a> Send for ScriptAnalyzer<'a>
impl<'a> Sync for ScriptAnalyzer<'a>
impl<'a> Unpin for ScriptAnalyzer<'a>
impl<'a> UnwindSafe for ScriptAnalyzer<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more