Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/wire-credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
jovfer authored Mar 20, 2019
2 parents 533e9a2 + fb61434 commit 92e701f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
29 changes: 29 additions & 0 deletions libindy/src/services/pool/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,35 @@ mod tests {
test::cleanup_storage();
}

#[test]
pub fn pool_wrapper_sends_requests_to_two_nodes() {
test::cleanup_storage();

ProtocolVersion::set(2);
_write_genesis_txns();

let req = json!({
"reqId": 1,
"operation": {
"type": "105"
}
}).to_string();

let p: PoolSM<MockNetworker, MockRequestHandler> = PoolSM::new(Rc::new(RefCell::new(MockNetworker::new(0, 0, vec![]))), POOL, 1, 0, 0);
let p = p.handle_event(PoolEvent::CheckCache(1));
let p = p.handle_event(PoolEvent::Synced(MerkleTree::from_vec(vec![]).unwrap()));
let p = p.handle_event(PoolEvent::SendRequest(3, req, None, None));
assert_match!(PoolState::Active(_), p.state);
match p.state {
PoolState::Active(state) => {
assert_eq!(state.networker.borrow().events.len(), 2);
}
_ => assert!(false)
};

test::cleanup_storage();
}

#[test]
pub fn pool_wrapper_active_node_reply_works_for_no_request() {
test::cleanup_storage();
Expand Down
1 change: 1 addition & 0 deletions libindy/src/services/pool/request_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ impl<T: Networker> RequestSM<T> {
}
}
RequestEvent::CustomSingleRequest(msg, req_id) => {
state.networker.borrow_mut().process_event(Some(NetworkerEvent::SendOneRequest(msg.clone(), req_id.clone(), timeout)));
state.networker.borrow_mut().process_event(Some(NetworkerEvent::SendOneRequest(msg, req_id, timeout)));
(RequestState::Single(state.into()), None)
}
Expand Down

0 comments on commit 92e701f

Please sign in to comment.