Skip to content

Commit

Permalink
[sdk] remove unused request context fields
Browse files Browse the repository at this point in the history
  • Loading branch information
phlip9 authored and bors-libra committed Jul 19, 2021
1 parent 402f030 commit 5f3191c
Showing 1 changed file with 2 additions and 27 deletions.
29 changes: 2 additions & 27 deletions sdk/client/src/verifying_client/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,7 @@ impl VerifyingBatch {
.map(|request| {
let n = request.subrequests.len();
let subresponses = responses_iter.by_ref().take(n).collect();
request.validate_subresponses(
request_trusted_state.version(),
&state,
&state_proof,
subresponses,
)
request.validate_subresponses(&state, &state_proof, subresponses)
})
.collect::<Vec<_>>();

Expand Down Expand Up @@ -189,18 +184,8 @@ fn verify_latest_li_matches_state(latest_li: &LedgerInfo, state: &State) -> Resu

#[derive(Clone, Copy)]
struct RequestContext<'a> {
#[allow(dead_code)]
start_version: Version,

state: &'a State,

state_proof: &'a StateProof,

#[allow(dead_code)]
request: &'a MethodRequest,

#[allow(dead_code)]
subrequests: &'a [MethodRequest],
}

type RequestCallback =
Expand Down Expand Up @@ -237,11 +222,8 @@ impl VerifyingRequest {
Self::new(self.request, self.subrequests, callback)
}

// TODO(philiphayes): this would be easier if the Error's were cloneable...

fn validate_subresponses(
self,
start_version: Version,
state: &State,
state_proof: &StateProof,
subresponses: Vec<Result<Response<MethodResponse>>>,
Expand All @@ -255,16 +237,9 @@ impl VerifyingRequest {
)));
}

let ctxt = RequestContext {
start_version,
state,
state_proof,
request: &self.request,
subrequests: &self.subrequests.as_slice(),
};
let ctxt = RequestContext { state, state_proof };

// TODO(philiphayes): coalesce the Result's somehow so we don't lose error info.

let subresponses_only = subresponses
.into_iter()
.map(|result| result.map(Response::into_inner))
Expand Down

0 comments on commit 5f3191c

Please sign in to comment.