Returning error when transaction is rejected (for consistency) (#1667)

This commit is contained in:
Tomasz Drwięga
2016-07-22 14:48:05 +02:00
committed by Gav Wood
parent 10bdfe6926
commit aafb014d01
2 changed files with 12 additions and 3 deletions

View File

@@ -72,6 +72,7 @@ mod error_codes {
pub const NO_AUTHOR_CODE: i64 = -32002;
pub const UNKNOWN_ERROR: i64 = -32009;
pub const TRANSACTION_ERROR: i64 = -32010;
pub const TRANSACTION_REJECTED: i64 = -32011;
pub const ACCOUNT_LOCKED: i64 = -32020;
pub const PASSWORD_INVALID: i64 = -32021;
pub const SIGNER_DISABLED: i64 = -32030;
@@ -139,7 +140,6 @@ fn default_gas_price<C, M>(client: &C, miner: &M) -> U256 where C: MiningBlockCh
.unwrap_or_else(|_| miner.sensible_gas_price())
}
fn signing_error(error: AccountError) -> Error {
Error {
code: ErrorCode::ServerError(error_codes::ACCOUNT_LOCKED),
@@ -156,6 +156,15 @@ fn password_error(error: AccountError) -> Error {
}
}
/// Error returned when transaction is rejected (in Trusted Signer).
pub fn transaction_rejected_error() -> Error {
Error {
code: ErrorCode::ServerError(error_codes::TRANSACTION_REJECTED),
message: "Transaction has been rejected.".into(),
data: None,
}
}
fn transaction_error(error: EthcoreError) -> Error {
use ethcore::error::TransactionError::*;