From e79bcd77ef6568cfa96caabe92a8b1df37fba93b Mon Sep 17 00:00:00 2001 From: Luca DG Date: Thu, 17 Apr 2025 10:43:21 -0300 Subject: [PATCH 1/3] Added simple docs to structs and enums of error --- crates/floresta-chain/src/pruned_utreexo/error.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/floresta-chain/src/pruned_utreexo/error.rs b/crates/floresta-chain/src/pruned_utreexo/error.rs index 1081ad739..445cd002b 100644 --- a/crates/floresta-chain/src/pruned_utreexo/error.rs +++ b/crates/floresta-chain/src/pruned_utreexo/error.rs @@ -17,6 +17,7 @@ use floresta_common::impl_error_from; use crate::prelude::*; pub trait DatabaseError: Debug + Send + Sync + 'static {} #[derive(Debug)] +/// Represents errors encountered during blockchain validation. pub enum BlockchainError { BlockNotPresent, Parsing(String), @@ -31,13 +32,16 @@ pub enum BlockchainError { ScriptValidationFailed(script::Error), Io(ioError), } + #[derive(Clone, Debug, PartialEq)] +/// Represents errors encountered during transaction validation. pub struct TransactionError { pub txid: Txid, pub error: BlockValidationErrors, } #[derive(Clone, Debug, PartialEq)] +/// Represents errors encountered during block validation. pub enum BlockValidationErrors { InvalidCoinbase(String), UtxoNotFound(OutPoint), From 626005398ddc32b66ddaa28b4815e7312346fe71 Mon Sep 17 00:00:00 2001 From: Luca DG Date: Tue, 22 Apr 2025 18:22:13 -0300 Subject: [PATCH 2/3] Added link to ChainState --- crates/floresta-chain/src/pruned_utreexo/error.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/floresta-chain/src/pruned_utreexo/error.rs b/crates/floresta-chain/src/pruned_utreexo/error.rs index 445cd002b..e28c8cbb9 100644 --- a/crates/floresta-chain/src/pruned_utreexo/error.rs +++ b/crates/floresta-chain/src/pruned_utreexo/error.rs @@ -17,7 +17,8 @@ use floresta_common::impl_error_from; use crate::prelude::*; pub trait DatabaseError: Debug + Send + Sync + 'static {} #[derive(Debug)] -/// Represents errors encountered during blockchain validation. +/// This is the highest level error type in floresta-chain, returned by the [crate::ChainState] methods. +/// It represents errors encountered during blockchain validation. pub enum BlockchainError { BlockNotPresent, Parsing(String), From a4cfc75f64099a4947ea7383f421057230ba3529 Mon Sep 17 00:00:00 2001 From: Luca DG Date: Wed, 23 Apr 2025 10:49:41 -0300 Subject: [PATCH 3/3] Added docs to TransactionError fields --- crates/floresta-chain/src/pruned_utreexo/error.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/floresta-chain/src/pruned_utreexo/error.rs b/crates/floresta-chain/src/pruned_utreexo/error.rs index e28c8cbb9..5130ce566 100644 --- a/crates/floresta-chain/src/pruned_utreexo/error.rs +++ b/crates/floresta-chain/src/pruned_utreexo/error.rs @@ -37,7 +37,10 @@ pub enum BlockchainError { #[derive(Clone, Debug, PartialEq)] /// Represents errors encountered during transaction validation. pub struct TransactionError { + /// The id of the transaction that caused this error pub txid: Txid, + + /// The error we've encountered pub error: BlockValidationErrors, }