global: fixes + snapshot + packages

This commit is contained in:
nym21
2025-04-26 17:22:58 +02:00
parent 07618ebe43
commit 82bcc55645
44 changed files with 6462 additions and 1973 deletions
+96 -98
View File
@@ -4,92 +4,89 @@ use color_eyre::eyre::eyre;
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub enum Index {
Addressindex,
Dateindex,
DateIndex,
DecadeIndex,
DifficultyEpoch,
EmptyOutputIndex,
HalvingEpoch,
Height,
P2PK33index,
P2PK65index,
P2PKHindex,
P2SHindex,
P2TRindex,
P2WPKHindex,
P2WSHindex,
Txindex,
Inputindex,
Outputindex,
Weekindex,
Monthindex,
Quarterindex,
Yearindex,
Decadeindex,
Difficultyepoch,
Halvingepoch,
Emptyindex,
P2MSindex,
Opreturnindex,
Pushonlyindex,
Unknownindex,
InputIndex,
MonthIndex,
OpReturnIndex,
OutputIndex,
P2AIndex,
P2MSIndex,
P2PK33Index,
P2PK65Index,
P2PKHIndex,
P2SHIndex,
P2TRIndex,
P2WPKHIndex,
P2WSHIndex,
QuarterIndex,
TxIndex,
UnknownOutputIndex,
WeekIndex,
YearIndex,
}
impl Index {
pub fn all() -> [Self; 25] {
pub fn all() -> [Self; 24] {
[
Self::DateIndex,
Self::DecadeIndex,
Self::DifficultyEpoch,
Self::EmptyOutputIndex,
Self::HalvingEpoch,
Self::Height,
Self::Dateindex,
Self::Weekindex,
Self::Difficultyepoch,
Self::Monthindex,
Self::Quarterindex,
Self::Yearindex,
Self::Decadeindex,
Self::Halvingepoch,
Self::Addressindex,
Self::P2PK33index,
Self::P2PK65index,
Self::P2PKHindex,
Self::P2SHindex,
Self::P2TRindex,
Self::P2WPKHindex,
Self::P2WSHindex,
Self::Txindex,
Self::Inputindex,
Self::Outputindex,
Self::Emptyindex,
Self::P2MSindex,
Self::Opreturnindex,
Self::Pushonlyindex,
Self::Unknownindex,
Self::InputIndex,
Self::MonthIndex,
Self::OpReturnIndex,
Self::OutputIndex,
Self::P2AIndex,
Self::P2MSIndex,
Self::P2PK33Index,
Self::P2PK65Index,
Self::P2PKHIndex,
Self::P2SHIndex,
Self::P2TRIndex,
Self::P2WPKHIndex,
Self::P2WSHIndex,
Self::QuarterIndex,
Self::TxIndex,
Self::UnknownOutputIndex,
Self::WeekIndex,
Self::YearIndex,
]
}
pub fn possible_values(&self) -> &[&str] {
// Always have the "correct" id at the end
match self {
Self::DateIndex => &["d", "date", "dateindex"],
Self::DecadeIndex => &["decade", "decadeindex"],
Self::DifficultyEpoch => &["difficulty", "difficultyepoch"],
Self::EmptyOutputIndex => &["empty", "emptyoutputindex"],
Self::HalvingEpoch => &["h", "halving", "halvingepoch"],
Self::Height => &["h", "height"],
Self::Dateindex => &["d", "date", "dateindex"],
Self::Weekindex => &["w", "week", "weekindex"],
Self::Difficultyepoch => &["difficulty", "difficultyepoch"],
Self::Monthindex => &["m", "month", "monthindex"],
Self::Quarterindex => &["q", "quarter", "quarterindex"],
Self::Yearindex => &["y", "year", "yearindex"],
Self::Decadeindex => &["decade", "decadeindex"],
Self::Halvingepoch => &["h", "halving", "halvingepoch"],
Self::Txindex => &["tx", "txindex"],
Self::Inputindex => &["txin", "inputindex"],
Self::Outputindex => &["txout", "outputindex"],
Self::Addressindex => &["a", "address", "addressindex"],
Self::P2PK33index => &["p2pk33", "p2pk33index"],
Self::P2PK65index => &["p2pk65", "p2pk65index"],
Self::P2PKHindex => &["p2pkh", "p2pkhindex"],
Self::P2SHindex => &["p2sh", "p2shindex"],
Self::P2TRindex => &["p2tr", "p2trindex"],
Self::P2WPKHindex => &["p2wpkh", "p2wpkhindex"],
Self::P2WSHindex => &["p2wsh", "p2wshindex"],
Self::Emptyindex => &["empty", "emptyoutputindex"],
Self::P2MSindex => &["multisig", "p2msindex"],
Self::Opreturnindex => &["opreturn", "opreturnindex"],
Self::Pushonlyindex => &["pushonly", "pushonlyindex"],
Self::Unknownindex => &["unknown", "unknownoutputindex"],
Self::InputIndex => &["txin", "inputindex"],
Self::MonthIndex => &["m", "month", "monthindex"],
Self::OpReturnIndex => &["opreturn", "opreturnindex"],
Self::OutputIndex => &["txout", "outputindex"],
Self::P2AIndex => &["p2a", "p2aindex"],
Self::P2MSIndex => &["p2ms", "p2msindex"],
Self::P2PK33Index => &["p2pk33", "p2pk33index"],
Self::P2PK65Index => &["p2pk65", "p2pk65index"],
Self::P2PKHIndex => &["p2pkh", "p2pkhindex"],
Self::P2SHIndex => &["p2sh", "p2shindex"],
Self::P2TRIndex => &["p2tr", "p2trindex"],
Self::P2WPKHIndex => &["p2wpkh", "p2wpkhindex"],
Self::P2WSHIndex => &["p2wsh", "p2wshindex"],
Self::QuarterIndex => &["q", "quarter", "quarterindex"],
Self::TxIndex => &["tx", "txindex"],
Self::UnknownOutputIndex => &["unknown", "unknownoutputindex"],
Self::WeekIndex => &["w", "week", "weekindex"],
Self::YearIndex => &["y", "year", "yearindex"],
}
}
@@ -117,32 +114,33 @@ impl TryFrom<&str> for Index {
type Error = color_eyre::Report;
fn try_from(value: &str) -> Result<Self, Self::Error> {
Ok(match value.to_lowercase().as_str() {
v if (Self::Dateindex).possible_values().contains(&v) => Self::Dateindex,
v if (Self::DateIndex).possible_values().contains(&v) => Self::DateIndex,
v if (Self::DecadeIndex).possible_values().contains(&v) => Self::DecadeIndex,
v if (Self::DifficultyEpoch).possible_values().contains(&v) => Self::DifficultyEpoch,
v if (Self::EmptyOutputIndex).possible_values().contains(&v) => Self::EmptyOutputIndex,
v if (Self::HalvingEpoch).possible_values().contains(&v) => Self::HalvingEpoch,
v if (Self::Height).possible_values().contains(&v) => Self::Height,
v if (Self::Txindex).possible_values().contains(&v) => Self::Txindex,
v if (Self::Inputindex).possible_values().contains(&v) => Self::Inputindex,
v if (Self::Outputindex).possible_values().contains(&v) => Self::Outputindex,
v if (Self::Addressindex).possible_values().contains(&v) => Self::Addressindex,
v if (Self::P2PK33index).possible_values().contains(&v) => Self::P2PK33index,
v if (Self::P2PK65index).possible_values().contains(&v) => Self::P2PK65index,
v if (Self::P2PKHindex).possible_values().contains(&v) => Self::P2PKHindex,
v if (Self::P2SHindex).possible_values().contains(&v) => Self::P2SHindex,
v if (Self::P2TRindex).possible_values().contains(&v) => Self::P2TRindex,
v if (Self::P2WPKHindex).possible_values().contains(&v) => Self::P2WPKHindex,
v if (Self::P2WSHindex).possible_values().contains(&v) => Self::P2WSHindex,
v if (Self::Weekindex).possible_values().contains(&v) => Self::Weekindex,
v if (Self::Monthindex).possible_values().contains(&v) => Self::Monthindex,
v if (Self::Yearindex).possible_values().contains(&v) => Self::Yearindex,
v if (Self::Decadeindex).possible_values().contains(&v) => Self::Decadeindex,
v if (Self::Difficultyepoch).possible_values().contains(&v) => Self::Difficultyepoch,
v if (Self::Halvingepoch).possible_values().contains(&v) => Self::Halvingepoch,
v if (Self::Quarterindex).possible_values().contains(&v) => Self::Quarterindex,
v if (Self::Quarterindex).possible_values().contains(&v) => Self::Quarterindex,
v if (Self::Emptyindex).possible_values().contains(&v) => Self::Emptyindex,
v if (Self::P2MSindex).possible_values().contains(&v) => Self::P2MSindex,
v if (Self::Opreturnindex).possible_values().contains(&v) => Self::Opreturnindex,
v if (Self::Pushonlyindex).possible_values().contains(&v) => Self::Pushonlyindex,
v if (Self::Unknownindex).possible_values().contains(&v) => Self::Unknownindex,
v if (Self::InputIndex).possible_values().contains(&v) => Self::InputIndex,
v if (Self::MonthIndex).possible_values().contains(&v) => Self::MonthIndex,
v if (Self::OpReturnIndex).possible_values().contains(&v) => Self::OpReturnIndex,
v if (Self::OutputIndex).possible_values().contains(&v) => Self::OutputIndex,
v if (Self::P2AIndex).possible_values().contains(&v) => Self::P2AIndex,
v if (Self::P2MSIndex).possible_values().contains(&v) => Self::P2MSIndex,
v if (Self::P2PK33Index).possible_values().contains(&v) => Self::P2PK33Index,
v if (Self::P2PK65Index).possible_values().contains(&v) => Self::P2PK65Index,
v if (Self::P2PKHIndex).possible_values().contains(&v) => Self::P2PKHIndex,
v if (Self::P2SHIndex).possible_values().contains(&v) => Self::P2SHIndex,
v if (Self::P2TRIndex).possible_values().contains(&v) => Self::P2TRIndex,
v if (Self::P2WPKHIndex).possible_values().contains(&v) => Self::P2WPKHIndex,
v if (Self::P2WSHIndex).possible_values().contains(&v) => Self::P2WSHIndex,
v if (Self::QuarterIndex).possible_values().contains(&v) => Self::QuarterIndex,
v if (Self::QuarterIndex).possible_values().contains(&v) => Self::QuarterIndex,
v if (Self::TxIndex).possible_values().contains(&v) => Self::TxIndex,
v if (Self::WeekIndex).possible_values().contains(&v) => Self::WeekIndex,
v if (Self::YearIndex).possible_values().contains(&v) => Self::YearIndex,
v if (Self::UnknownOutputIndex).possible_values().contains(&v) => {
Self::UnknownOutputIndex
}
_ => return Err(eyre!("Bad index")),
})
}