2020-09-09 16:42:52 -07:00
|
|
|
use std::sync::Arc;
|
2020-09-09 17:59:58 -07:00
|
|
|
use zebra_chain::{
|
|
|
|
block::{self, Block},
|
|
|
|
transaction::Transaction,
|
|
|
|
};
|
|
|
|
|
|
|
|
// Allow *only* this unused import, so that rustdoc link resolution
|
|
|
|
// will work with inline links.
|
|
|
|
#[allow(unused_imports)]
|
|
|
|
use crate::Request;
|
2020-09-09 16:42:52 -07:00
|
|
|
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
2020-09-09 17:59:58 -07:00
|
|
|
/// A response to a state [`Request`].
|
2020-09-09 16:42:52 -07:00
|
|
|
pub enum Response {
|
2020-09-09 17:59:58 -07:00
|
|
|
/// Response to [`Request::CommitBlock`] indicating that a block was
|
|
|
|
/// successfully committed to the state.
|
|
|
|
Committed(block::Hash),
|
|
|
|
|
|
|
|
/// Response to [`Request::Depth`] with the depth of the specified block.
|
|
|
|
Depth(Option<block::Height>),
|
|
|
|
|
|
|
|
/// Response to [`Request::Tip`] with the current best chain tip.
|
|
|
|
Tip(Option<block::Hash>),
|
|
|
|
|
|
|
|
/// Response to [`Request::BlockLocator`] with a block locator object.
|
|
|
|
BlockLocator(Vec<block::Hash>),
|
|
|
|
|
|
|
|
/// Response to [`Request::Transaction`] with the specified transaction.
|
|
|
|
Transaction(Option<Arc<Transaction>>),
|
|
|
|
|
|
|
|
/// Response to [`Request::Block`] with the specified block.
|
|
|
|
Block(Option<Arc<Block>>),
|
2020-09-09 16:42:52 -07:00
|
|
|
}
|