Add a new RPC parity_submitWorkDetail similar eth_submitWork but return block hash (#9404)
* add a new RPC `eth_submitWorkDetail`similar `eth_submitWork`. It has more details (block hash, error message, and more in future) in its response and not only the `true` or `false`. * move RPC submitWorkDetail from namespace eth_ to parity_ * remove SubmitDetailResult type; submitWorkDetail return a error when failed * change error message of RPC error `cannot_submit_work`. * remove double imported H256. * put submit_work_detail into a helper to avoid the duplicate codes.
This commit is contained in:
@@ -35,6 +35,7 @@ mod codes {
|
||||
pub const NO_AUTHOR: i64 = -32002;
|
||||
pub const NO_NEW_WORK: i64 = -32003;
|
||||
pub const NO_WORK_REQUIRED: i64 = -32004;
|
||||
pub const CANNOT_SUBMIT_WORK: i64 = -32005;
|
||||
pub const UNKNOWN_ERROR: i64 = -32009;
|
||||
pub const TRANSACTION_ERROR: i64 = -32010;
|
||||
pub const EXECUTION_ERROR: i64 = -32015;
|
||||
@@ -197,6 +198,14 @@ pub fn no_work_required() -> Error {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn cannot_submit_work(err: EthcoreError) -> Error {
|
||||
Error {
|
||||
code: ErrorCode::ServerError(codes::CANNOT_SUBMIT_WORK),
|
||||
message: "Cannot submit work.".into(),
|
||||
data: Some(Value::String(err.to_string())),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn not_enough_data() -> Error {
|
||||
Error {
|
||||
code: ErrorCode::ServerError(codes::UNSUPPORTED_REQUEST),
|
||||
|
||||
Reference in New Issue
Block a user