Remove impending_requests from Process
This commit is contained in:
parent
eda4b18770
commit
f1ba34eddd
@ -234,13 +234,11 @@ impl ProcessState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A process is basically a succession of states
|
/// A process is basically a succession of states
|
||||||
/// If a process has nothing to do with us, impending_requests will be empty
|
|
||||||
/// The latest state MUST be an empty state with only the commited_in field set at the last unspent outpoint
|
/// The latest state MUST be an empty state with only the commited_in field set at the last unspent outpoint
|
||||||
#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize, Tsify)]
|
#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize, Tsify)]
|
||||||
#[tsify(into_wasm_abi)]
|
#[tsify(into_wasm_abi)]
|
||||||
pub struct Process {
|
pub struct Process {
|
||||||
states: Vec<ProcessState>,
|
states: Vec<ProcessState>,
|
||||||
impending_requests: Vec<Prd>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Process {
|
impl Process {
|
||||||
@ -253,7 +251,6 @@ impl Process {
|
|||||||
};
|
};
|
||||||
Self {
|
Self {
|
||||||
states: vec![empty_state],
|
states: vec![empty_state],
|
||||||
impending_requests: vec![],
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,24 +461,6 @@ impl Process {
|
|||||||
.find(|s| s.commited_in != latest_outpoint);
|
.find(|s| s.commited_in != latest_outpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn insert_impending_request(&mut self, request: Prd) {
|
|
||||||
self.impending_requests.push(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_impending_requests(&self) -> Vec<&Prd> {
|
|
||||||
self.impending_requests.iter().collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_impending_requests_mut(&mut self) -> Vec<&mut Prd> {
|
|
||||||
self.impending_requests.iter_mut().collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn prune_impending_requests(&mut self) {
|
|
||||||
self.impending_requests = self.impending_requests.clone().into_iter()
|
|
||||||
.filter(|r| r.prd_type != PrdType::None)
|
|
||||||
.collect();
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_state_index(&self, state: &ProcessState) -> Option<usize> {
|
pub fn get_state_index(&self, state: &ProcessState) -> Option<usize> {
|
||||||
// Get the commited_in value of the provided state
|
// Get the commited_in value of the provided state
|
||||||
let target_commited_in = state.commited_in;
|
let target_commited_in = state.commited_in;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user