From 3185301c97893537fb8acc9099933117f2b91501 Mon Sep 17 00:00:00 2001 From: arkpar Date: Mon, 11 Jan 2016 13:51:58 +0100 Subject: [PATCH] Updated docs --- src/engine.rs | 13 +++++++++---- src/verification.rs | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/engine.rs b/src/engine.rs index 65f3a4b9f..aed9fe2f3 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -33,12 +33,17 @@ pub trait Engine : Sync + Send { fn on_new_block(&self, _block: &mut Block) {} fn on_close_block(&self, _block: &mut Block) {} - /// Verify that `header` is valid. - /// `parent` (the parent header) and `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. - // TODO: consider including State in the params. + // TODO: consider including State in the params for verification functions. + /// Phase 1 quick block verification. Only does checks that are cheap. `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_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(()) } + + /// 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(()) } /// Additional verification for transactions in blocks. diff --git a/src/verification.rs b/src/verification.rs index 1d34ddff4..be885162a 100644 --- a/src/verification.rs +++ b/src/verification.rs @@ -36,7 +36,7 @@ pub fn verify_block_unordered(bytes: &[u8], engine: &Engine) -> Result<(), Error 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> { let block = BlockView::new(bytes); let header = block.header();