[verify] Add documentation

This commit is contained in:
Alekos Filini 2021-06-18 13:16:58 +02:00
parent a67aca32c0
commit 975905c8ea
No known key found for this signature in database
GPG Key ID: 431401E4A4530061

View File

@ -9,6 +9,8 @@
// You may not use this file except in accordance with one or both of these // You may not use this file except in accordance with one or both of these
// licenses. // licenses.
//! Verify transactions against the consensus rules
use std::collections::HashMap; use std::collections::HashMap;
use std::fmt; use std::fmt;
@ -68,13 +70,20 @@ pub fn verify_tx<D: Database, B: Blockchain>(
Ok(()) Ok(())
} }
/// Error during validation of a tx agains the consensus rules
#[derive(Debug)] #[derive(Debug)]
pub enum VerifyError { pub enum VerifyError {
/// The transaction being spent is not available in the database or the blockchain client
MissingInputTx(Txid), MissingInputTx(Txid),
/// The transaction being spent doesn't have the requested output
InvalidInput(OutPoint), InvalidInput(OutPoint),
/// Consensus error
Consensus(bitcoinconsensus::Error), Consensus(bitcoinconsensus::Error),
/// Generic error
///
/// It has to be wrapped in a `Box` since `Error` has a variant that contains this enum
Global(Box<Error>), Global(Box<Error>),
} }