@@ -52,6 +52,9 @@ pub enum ScriptContextError {
5252 /// The Miniscript (under p2sh context) corresponding Script would be
5353 /// larger than `MAX_SCRIPT_ELEMENT_SIZE` bytes.
5454 MaxRedeemScriptSizeExceeded ,
55+ /// The Miniscript(under bare context) corresponding
56+ /// Script would be larger than `MAX_SCRIPT_SIZE` bytes.
57+ MaxBareScriptSizeExceeded ,
5558 /// The policy rules of bitcoin core only permit Script size upto 1650 bytes
5659 MaxScriptSigSizeExceeded ,
5760 /// Impossible to satisfy the miniscript under the current context
@@ -80,6 +83,7 @@ impl error::Error for ScriptContextError {
8083 | MaxOpCountExceeded
8184 | MaxWitnessScriptSizeExceeded
8285 | MaxRedeemScriptSizeExceeded
86+ | MaxBareScriptSizeExceeded
8387 | MaxScriptSigSizeExceeded
8488 | ImpossibleSatisfaction
8589 | TaprootMultiDisabled
@@ -127,6 +131,11 @@ impl fmt::Display for ScriptContextError {
127131 "The Miniscript corresponding Script would be larger than \
128132 MAX_SCRIPT_ELEMENT_SIZE bytes."
129133 ) ,
134+ ScriptContextError :: MaxBareScriptSizeExceeded => write ! (
135+ f,
136+ "The Miniscript corresponding Script would be larger than \
137+ MAX_SCRIPT_SIZE bytes."
138+ ) ,
130139 ScriptContextError :: MaxScriptSigSizeExceeded => write ! (
131140 f,
132141 "At least one satisfaction in Miniscript would be larger than \
@@ -740,7 +749,7 @@ impl ScriptContext for BareCtx {
740749 match node_checked {
741750 Ok ( _) => {
742751 if ms. ext . pk_cost > MAX_SCRIPT_SIZE {
743- Err ( ScriptContextError :: MaxWitnessScriptSizeExceeded )
752+ Err ( ScriptContextError :: MaxBareScriptSizeExceeded )
744753 } else {
745754 Ok ( ( ) )
746755 }
0 commit comments