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,
|
|
|
|
};
|
|
|
|
|
2020-11-23 12:02:57 -08:00
|
|
|
use crate::Utxo;
|
|
|
|
|
2020-09-09 17:59:58 -07:00
|
|
|
// 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.
|
2020-09-09 22:05:47 -07:00
|
|
|
Depth(Option<u32>),
|
2020-09-09 17:59:58 -07:00
|
|
|
|
|
|
|
/// Response to [`Request::Tip`] with the current best chain tip.
|
2020-09-09 22:05:47 -07:00
|
|
|
Tip(Option<(block::Height, block::Hash)>),
|
2020-09-09 17:59:58 -07:00
|
|
|
|
|
|
|
/// 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-10-14 14:06:32 -07:00
|
|
|
|
2020-11-30 13:30:37 -08:00
|
|
|
/// The response to a `AwaitUtxo` request.
|
2020-11-23 12:02:57 -08:00
|
|
|
Utxo(Utxo),
|
2020-11-30 13:30:37 -08:00
|
|
|
|
|
|
|
/// The response to a `FindBlockHashes` request.
|
|
|
|
BlockHashes(Vec<block::Hash>),
|
|
|
|
|
|
|
|
/// The response to a `FindBlockHeaders` request.
|
|
|
|
BlockHeaders(Vec<block::Header>),
|
2020-09-09 16:42:52 -07:00
|
|
|
}
|