Updated docs
This commit is contained in:
parent
0221d47544
commit
3185301c97
@ -33,12 +33,17 @@ pub trait Engine : Sync + Send {
|
|||||||
fn on_new_block(&self, _block: &mut Block) {}
|
fn on_new_block(&self, _block: &mut Block) {}
|
||||||
fn on_close_block(&self, _block: &mut Block) {}
|
fn on_close_block(&self, _block: &mut Block) {}
|
||||||
|
|
||||||
/// Verify that `header` is valid.
|
// TODO: consider including State in the params for verification functions.
|
||||||
/// `parent` (the parent header) and `block` (the header's full block) may be provided for additional
|
/// Phase 1 quick block verification. Only does checks that are cheap. `block` (the header's full block)
|
||||||
/// checks. Returns either a null `Ok` or a general error detailing the problem with import.
|
/// may be provided for additional checks. Returns either a null `Ok` or a general error detailing the problem with import.
|
||||||
// TODO: consider including State in the params.
|
|
||||||
fn verify_block_basic(&self, _header: &Header, _block: Option<&[u8]>) -> Result<(), Error> { Ok(()) }
|
fn verify_block_basic(&self, _header: &Header, _block: Option<&[u8]>) -> Result<(), Error> { Ok(()) }
|
||||||
|
|
||||||
|
/// Phase 2 verification. Perform costly checks such as transaction signatures. `block` (the header's full block)
|
||||||
|
/// may be provided for additional checks. Returns either a null `Ok` or a general error detailing the problem with import.
|
||||||
fn verify_block_unordered(&self, _header: &Header, _block: Option<&[u8]>) -> Result<(), Error> { Ok(()) }
|
fn verify_block_unordered(&self, _header: &Header, _block: Option<&[u8]>) -> Result<(), Error> { Ok(()) }
|
||||||
|
|
||||||
|
/// Phase 3 verification. Check block information against parent and uncles. `block` (the header's full block)
|
||||||
|
/// may be provided for additional checks. Returns either a null `Ok` or a general error detailing the problem with import.
|
||||||
fn verify_block_final(&self, _header: &Header, _parent: &Header, _block: Option<&[u8]>) -> Result<(), Error> { Ok(()) }
|
fn verify_block_final(&self, _header: &Header, _parent: &Header, _block: Option<&[u8]>) -> Result<(), Error> { Ok(()) }
|
||||||
|
|
||||||
/// Additional verification for transactions in blocks.
|
/// Additional verification for transactions in blocks.
|
||||||
|
@ -36,7 +36,7 @@ pub fn verify_block_unordered(bytes: &[u8], engine: &Engine) -> Result<(), Error
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Phase 3 verification. Check block information against parents and uncles.
|
/// Phase 3 verification. Check block information against parent and uncles.
|
||||||
pub fn verify_block_final(bytes: &[u8], engine: &Engine, bc: &BlockChain) -> Result<(), Error> {
|
pub fn verify_block_final(bytes: &[u8], engine: &Engine, bc: &BlockChain) -> Result<(), Error> {
|
||||||
let block = BlockView::new(bytes);
|
let block = BlockView::new(bytes);
|
||||||
let header = block.header();
|
let header = block.header();
|
||||||
|
Loading…
Reference in New Issue
Block a user