Implement get_last_id() with transaction_count()
This is more precice than the previous implementation because it'll drain the EntryInfo queue and return the most recent last_id instead of the first one.
This commit is contained in:
parent
f752e02487
commit
1feff408ff
|
@ -108,14 +108,7 @@ impl AccountantStub {
|
|||
/// Request the last Entry ID from the server. This method blocks
|
||||
/// until the server sends a response.
|
||||
pub fn get_last_id(&mut self) -> FutureResult<Hash, ()> {
|
||||
let mut done = false;
|
||||
while !done {
|
||||
let resp = self.recv_response().expect("recv response");
|
||||
if let &Response::EntryInfo { .. } = &resp {
|
||||
done = true;
|
||||
}
|
||||
self.process_response(resp);
|
||||
}
|
||||
self.transaction_count();
|
||||
ok(self.last_id.unwrap_or(Hash::default()))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue