Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
fix(grumbles): remove error + updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasad1 committed Apr 3, 2019
1 parent 99fa56d commit 23d41cb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions rpc/src/v1/helpers/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ mod codes {
pub const FETCH_ERROR: i64 = -32060;
pub const NO_LIGHT_PEERS: i64 = -32065;
pub const NO_PEERS: i64 = -32066;
pub const NO_LIGHT_TRANSACTIONS: i64 = -32066;
pub const DEPRECATED: i64 = -32070;
pub const EXPERIMENTAL_RPC: i64 = -32071;
pub const CANNOT_RESTART: i64 = -32080;
Expand Down Expand Up @@ -505,14 +504,6 @@ pub fn no_light_peers() -> Error {
}
}

pub fn no_light_transactions() -> Error {
Error {
code: ErrorCode::ServerError(codes::NO_LIGHT_TRANSACTIONS),
message: "No pending transactions in the light transaction queue".into(),
data: None,
}
}

pub fn deprecated<S: Into<String>, T: Into<Option<S>>>(message: T) -> Error {
Error {
code: ErrorCode::ServerError(codes::DEPRECATED),
Expand Down
3 changes: 2 additions & 1 deletion rpc/src/v1/helpers/light_fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,10 +522,11 @@ where
}))
}

/// Helper to cull the `light` transaction queue of mined transactions
pub fn light_cull(&self, txq: Arc<RwLock<TransactionQueue>>) -> impl Future <Item = (), Error = Error> + Send {
let senders = txq.read().queued_senders();
if senders.is_empty() {
return Either::B(future::err(errors::no_light_transactions()));
return Either::B(future::err(errors::internal("No pending local transactions", "")));
}

let sync = self.sync.clone();
Expand Down
8 changes: 4 additions & 4 deletions rpc/src/v1/impls/light/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,10 @@ where
fn transaction_by_hash(&self, hash: H256) -> BoxFuture<Option<Transaction>> {
let in_txqueue = self.transaction_queue.read().get(&hash).is_some();

// The transaction is in the `local txqueue`
// Check if the nonce on the accounts are still fresh and return result from
// the `local txqueue` if it is still fresh.
// Otherwise make a network request to fetch the transaction from the network
// The transaction is in the `local txqueue` then fetch the latest state from the network and attempt
// to cull the transaction queue.
//
// If it fails return the local transaction
if in_txqueue {
// Note, this will block (relies on HTTP timeout) to make sure `cull` will finish to avoid having to call
// `eth_getTransactionByHash` more than once to ensure the `txqueue` is up to `date` when it is called
Expand Down

0 comments on commit 23d41cb

Please sign in to comment.