Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions dash-spv/src/client/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ pub type Result<T> = std::result::Result<T, SpvError>;

pub type GetQuorumByHeightResult = Result<QualifiedQuorumEntry>;

async fn receive<Type>(context: String, receiver: oneshot::Receiver<Type>) -> Result<Type> {
receiver.await.map_err(|error| SpvError::ChannelFailure(context, error.to_string()))
}

pub enum DashSpvClientCommand {
GetQuorumByHeight {
height: u32,
Expand Down Expand Up @@ -46,34 +42,3 @@ impl Display for DashSpvClientCommand {
write!(f, "{}", str)
}
}

#[derive(Clone)]
pub struct DashSpvClientInterface {
pub command_sender: mpsc::UnboundedSender<DashSpvClientCommand>,
}

impl DashSpvClientInterface {
pub fn new(command_sender: mpsc::UnboundedSender<DashSpvClientCommand>) -> Self {
Self {
command_sender,
}
}

pub async fn get_quorum_by_height(
&self,
height: u32,
quorum_type: LLMQType,
quorum_hash: QuorumHash,
) -> GetQuorumByHeightResult {
let (sender, receiver) = oneshot::channel();
let command = DashSpvClientCommand::GetQuorumByHeight {
height,
quorum_type,
quorum_hash,
sender,
};
let context = command.to_string();
command.send(context.clone(), self.command_sender.clone()).await?;
receive(context, receiver).await?
}
}
Loading