Skip to content

Commit 0666aef

Browse files
committed
error: remove some unused variants
There is more to come, but do a bunch now because it's cathartic.
1 parent b2ec4a8 commit 0666aef

File tree

1 file changed

+0
-44
lines changed

1 file changed

+0
-44
lines changed

src/lib.rs

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,6 @@ pub enum Error {
443443
Unexpected(String),
444444
/// Name of a fragment contained `:` multiple times
445445
MultiColon(String),
446-
/// Name of a fragment contained `@` multiple times
447-
MultiAt(String),
448446
/// Name of a fragment contained `@` but we were not parsing an OR
449447
AtOutsideOr(String),
450448
/// Encountered a wrapping character that we don't recognize
@@ -453,16 +451,8 @@ pub enum Error {
453451
NonTopLevel(String),
454452
/// Parsed a miniscript but there were more script opcodes after it
455453
Trailing(String),
456-
/// Failed to parse a push as a public key
457-
BadPubkey(bitcoin::key::Error),
458-
/// Could not satisfy a script (fragment) because of a missing hash preimage
459-
MissingHash(sha256::Hash),
460454
/// Could not satisfy a script (fragment) because of a missing signature
461455
MissingSig(bitcoin::PublicKey),
462-
/// Could not satisfy, relative locktime not met
463-
RelativeLocktimeNotMet(u32),
464-
/// Could not satisfy, absolute locktime not met
465-
AbsoluteLocktimeNotMet(u32),
466456
/// General failure to satisfy
467457
CouldNotSatisfy,
468458
/// Typechecking failed
@@ -482,8 +472,6 @@ pub enum Error {
482472
ContextError(miniscript::context::ScriptContextError),
483473
/// Recursion depth exceeded when parsing policy/miniscript from string
484474
MaxRecursiveDepthExceeded,
485-
/// Script size too large
486-
ScriptSizeTooLarge,
487475
/// Anything but c:pk(key) (P2PK), c:pk_h(key) (P2PKH), and thresh_m(k,...)
488476
/// up to n=3 is invalid by standardness (bare)
489477
NonStandardBareScript,
@@ -495,12 +483,8 @@ pub enum Error {
495483
BareDescriptorAddr,
496484
/// PubKey invalid under current context
497485
PubKeyCtxError(miniscript::decode::KeyParseError, &'static str),
498-
/// Attempted to call function that requires PreComputed taproot info
499-
TaprootSpendInfoUnavialable,
500486
/// No script code for Tr descriptors
501487
TrNoScriptCode,
502-
/// No explicit script for Tr descriptors
503-
TrNoExplicitScript,
504488
/// At least two BIP389 key expressions in the descriptor contain tuples of
505489
/// derivation indexes of different lengths.
506490
MultipathDescLenMismatch,
@@ -512,8 +496,6 @@ pub enum Error {
512496

513497
// https://github.com/sipa/miniscript/pull/5 for discussion on this number
514498
const MAX_RECURSION_DEPTH: u32 = 402;
515-
// https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki
516-
const MAX_SCRIPT_SIZE: u32 = 10000;
517499

518500
impl fmt::Display for Error {
519501
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@@ -531,23 +513,12 @@ impl fmt::Display for Error {
531513
Error::UnexpectedStart => f.write_str("unexpected start of script"),
532514
Error::Unexpected(ref s) => write!(f, "unexpected «{}»", s),
533515
Error::MultiColon(ref s) => write!(f, "«{}» has multiple instances of «:»", s),
534-
Error::MultiAt(ref s) => write!(f, "«{}» has multiple instances of «@»", s),
535516
Error::AtOutsideOr(ref s) => write!(f, "«{}» contains «@» in non-or() context", s),
536517
Error::UnknownWrapper(ch) => write!(f, "unknown wrapper «{}:»", ch),
537518
Error::NonTopLevel(ref s) => write!(f, "non-T miniscript: {}", s),
538519
Error::Trailing(ref s) => write!(f, "trailing tokens: {}", s),
539-
Error::MissingHash(ref h) => write!(f, "missing preimage of hash {}", h),
540520
Error::MissingSig(ref pk) => write!(f, "missing signature for key {:?}", pk),
541-
Error::RelativeLocktimeNotMet(n) => {
542-
write!(f, "required relative locktime CSV of {} blocks, not met", n)
543-
}
544-
Error::AbsoluteLocktimeNotMet(n) => write!(
545-
f,
546-
"required absolute locktime CLTV of {} blocks, not met",
547-
n
548-
),
549521
Error::CouldNotSatisfy => f.write_str("could not satisfy"),
550-
Error::BadPubkey(ref e) => fmt::Display::fmt(e, f),
551522
Error::TypeCheck(ref e) => write!(f, "typecheck: {}", e),
552523
Error::BadDescriptor(ref e) => write!(f, "Invalid descriptor: {}", e),
553524
Error::Secp(ref e) => fmt::Display::fmt(e, f),
@@ -561,11 +532,6 @@ impl fmt::Display for Error {
561532
"Recursive depth over {} not permitted",
562533
MAX_RECURSION_DEPTH
563534
),
564-
Error::ScriptSizeTooLarge => write!(
565-
f,
566-
"Standardness rules imply bitcoin than {} bytes",
567-
MAX_SCRIPT_SIZE
568-
),
569535
Error::NonStandardBareScript => write!(
570536
f,
571537
"Anything but c:pk(key) (P2PK), c:pk_h(key) (P2PKH), and thresh_m(k,...) \
@@ -579,9 +545,7 @@ impl fmt::Display for Error {
579545
write!(f, "Pubkey error: {} under {} scriptcontext", pk, ctx)
580546
}
581547
Error::MultiATooManyKeys(k) => write!(f, "MultiA too many keys {}", k),
582-
Error::TaprootSpendInfoUnavialable => write!(f, "Taproot Spend Info not computed."),
583548
Error::TrNoScriptCode => write!(f, "No script code for Tr descriptors"),
584-
Error::TrNoExplicitScript => write!(f, "No script code for Tr descriptors"),
585549
Error::MultipathDescLenMismatch => write!(f, "At least two BIP389 key expressions in the descriptor contain tuples of derivation indexes of different lengths"),
586550
Error::AbsoluteLockTime(ref e) => e.fmt(f),
587551
Error::RelativeLockTime(ref e) => e.fmt(f),
@@ -605,30 +569,22 @@ impl error::Error for Error {
605569
| UnexpectedStart
606570
| Unexpected(_)
607571
| MultiColon(_)
608-
| MultiAt(_)
609572
| AtOutsideOr(_)
610573
| UnknownWrapper(_)
611574
| NonTopLevel(_)
612575
| Trailing(_)
613-
| MissingHash(_)
614576
| MissingSig(_)
615-
| RelativeLocktimeNotMet(_)
616-
| AbsoluteLocktimeNotMet(_)
617577
| CouldNotSatisfy
618578
| TypeCheck(_)
619579
| BadDescriptor(_)
620580
| MaxRecursiveDepthExceeded
621-
| ScriptSizeTooLarge
622581
| NonStandardBareScript
623582
| ImpossibleSatisfaction
624583
| BareDescriptorAddr
625-
| TaprootSpendInfoUnavialable
626584
| TrNoScriptCode
627-
| TrNoExplicitScript
628585
| MultipathDescLenMismatch => None,
629586
Script(e) => Some(e),
630587
AddrError(e) => Some(e),
631-
BadPubkey(e) => Some(e),
632588
Secp(e) => Some(e),
633589
#[cfg(feature = "compiler")]
634590
CompilerError(e) => Some(e),

0 commit comments

Comments
 (0)