Skip to content

Commit

Permalink
Implement ReadState Request::Transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
teor2345 committed Mar 15, 2022
1 parent 72e5b75 commit 2e7ff25
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions zebra-state/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -937,15 +937,24 @@ impl Service<Request> for ReadStateService {
}

// For the get_raw_transaction RPC, to be implemented in #3145.
Request::Transaction(_hash) => {
Request::Transaction(hash) => {
metrics::counter!(
"state.requests",
1,
"service" => "read_state",
"type" => "transaction",
);

unimplemented!("ReadStateService doesn't Transaction yet")
let state = self.clone();

async move {
let transaction = state.best_chain_receiver.with_watch_data(|best_chain| {
read::transaction(best_chain, &state.db, hash)
});

Ok(Response::Transaction(transaction))
}
.boxed()
}

// TODO: split the Request enum, then implement these new ReadRequests for lightwalletd
Expand Down

0 comments on commit 2e7ff25

Please sign in to comment.