@@ -760,8 +760,8 @@ impl ScriptContext for BareCtx {
760760/// scripts off of the blockchain without doing any sanity checks on them.
761761/// This context should *NOT* be used unless you know what you are doing.
762762#[ derive( Debug , Clone , Eq , PartialEq , Ord , PartialOrd , Hash ) ]
763- pub enum NoChecksEcdsa { }
764- impl ScriptContext for NoChecksEcdsa {
763+ pub enum NoChecks { }
764+ impl ScriptContext for NoChecks {
765765 // todo: When adding support for interpreter, we need a enum with all supported keys here
766766 type Key = bitcoin:: PublicKey ;
767767 fn check_terminal_non_malleable < Pk : MiniscriptKey > (
@@ -853,108 +853,9 @@ impl ScriptContext for NoChecksEcdsa {
853853 }
854854}
855855
856- /// "No Checks Schnorr" Context
857- ///
858- /// Used by the "satisified constraints" iterator, which is intended to read
859- /// scripts off of the blockchain without doing any sanity checks on them.
860- /// This context should *NOT* be used unless you know what you are doing.
861- #[ derive( Debug , Clone , Eq , PartialEq , Ord , PartialOrd , Hash ) ]
862- pub enum NoChecksSchnorr { }
863- impl ScriptContext for NoChecksSchnorr {
864- // todo: When adding support for interpreter, we need a enum with all supported keys here
865- type Key = bitcoin:: secp256k1:: XOnlyPublicKey ;
866- fn check_terminal_non_malleable < Pk : MiniscriptKey > (
867- _frag : & Terminal < Pk , Self > ,
868- ) -> Result < ( ) , ScriptContextError > {
869- Ok ( ( ) )
870- }
871-
872- fn check_global_policy_validity < Pk : MiniscriptKey > (
873- _ms : & Miniscript < Pk , Self > ,
874- ) -> Result < ( ) , ScriptContextError > {
875- Ok ( ( ) )
876- }
877-
878- fn check_global_consensus_validity < Pk : MiniscriptKey > (
879- _ms : & Miniscript < Pk , Self > ,
880- ) -> Result < ( ) , ScriptContextError > {
881- Ok ( ( ) )
882- }
883-
884- fn check_local_policy_validity < Pk : MiniscriptKey > (
885- _ms : & Miniscript < Pk , Self > ,
886- ) -> Result < ( ) , ScriptContextError > {
887- Ok ( ( ) )
888- }
889-
890- fn check_local_consensus_validity < Pk : MiniscriptKey > (
891- _ms : & Miniscript < Pk , Self > ,
892- ) -> Result < ( ) , ScriptContextError > {
893- Ok ( ( ) )
894- }
895-
896- fn max_satisfaction_size < Pk : MiniscriptKey > ( _ms : & Miniscript < Pk , Self > ) -> Option < usize > {
897- panic ! ( "Tried to compute a satisfaction size bound on a no-checks schnorr miniscript" )
898- }
899-
900- fn pk_len < Pk : MiniscriptKey > ( _pk : & Pk ) -> usize {
901- panic ! ( "Tried to compute a pk len bound on a no-checks schnorr miniscript" )
902- }
903-
904- fn name_str ( ) -> & ' static str {
905- // Internally used code
906- "NochecksSchnorr"
907- }
908-
909- fn check_witness < Pk : MiniscriptKey > ( _witness : & [ Vec < u8 > ] ) -> Result < ( ) , ScriptContextError > {
910- // Only really need to do this for segwitv0 and legacy
911- // Bare is already restrcited by standardness rules
912- // and would reach these limits.
913- Ok ( ( ) )
914- }
915-
916- fn check_global_validity < Pk : MiniscriptKey > (
917- ms : & Miniscript < Pk , Self > ,
918- ) -> Result < ( ) , ScriptContextError > {
919- Self :: check_global_consensus_validity ( ms) ?;
920- Self :: check_global_policy_validity ( ms) ?;
921- Ok ( ( ) )
922- }
923-
924- fn check_local_validity < Pk : MiniscriptKey > (
925- ms : & Miniscript < Pk , Self > ,
926- ) -> Result < ( ) , ScriptContextError > {
927- Self :: check_global_consensus_validity ( ms) ?;
928- Self :: check_global_policy_validity ( ms) ?;
929- Self :: check_local_consensus_validity ( ms) ?;
930- Self :: check_local_policy_validity ( ms) ?;
931- Ok ( ( ) )
932- }
933-
934- fn top_level_type_check < Pk : MiniscriptKey > ( ms : & Miniscript < Pk , Self > ) -> Result < ( ) , Error > {
935- if ms. ty . corr . base != types:: Base :: B {
936- return Err ( Error :: NonTopLevel ( format ! ( "{:?}" , ms) ) ) ;
937- }
938- Ok ( ( ) )
939- }
940-
941- fn other_top_level_checks < Pk : MiniscriptKey > ( _ms : & Miniscript < Pk , Self > ) -> Result < ( ) , Error > {
942- Ok ( ( ) )
943- }
944-
945- fn top_level_checks < Pk : MiniscriptKey > ( ms : & Miniscript < Pk , Self > ) -> Result < ( ) , Error > {
946- Self :: top_level_type_check ( ms) ?;
947- Self :: other_top_level_checks ( ms)
948- }
949-
950- fn sig_type ( ) -> SigType {
951- SigType :: Schnorr
952- }
953- }
954-
955856/// Private Mod to prevent downstream from implementing this public trait
956857mod private {
957- use super :: { BareCtx , Legacy , NoChecksEcdsa , NoChecksSchnorr , Segwitv0 , Tap } ;
858+ use super :: { BareCtx , Legacy , NoChecks , Segwitv0 , Tap } ;
958859
959860 pub trait Sealed { }
960861
@@ -963,6 +864,5 @@ mod private {
963864 impl Sealed for Legacy { }
964865 impl Sealed for Segwitv0 { }
965866 impl Sealed for Tap { }
966- impl Sealed for NoChecksEcdsa { }
967- impl Sealed for NoChecksSchnorr { }
867+ impl Sealed for NoChecks { }
968868}
0 commit comments