Errors & warnings for inappropriate RPCs (#6029)
* Clarify function name Function checks if sealing is currently underway, not to be confused with checking whether the engine performs internal sealing. * Error when work called on internal sealing engine * Error submitting work for internal sealing engine * Fix inverted bool and style grumbles * Add can_produce_work_package to TestMinerService * Error when setting engine signer on PoW chain * Unit tests for engine signing Setting engine signer should fail if chain does not seal internally or client lacks account provider. * Tweak TestMinerService * Fix minor style grumbles
This commit is contained in:
@@ -28,6 +28,7 @@ mod codes {
|
||||
pub const NO_WORK: i64 = -32001;
|
||||
pub const NO_AUTHOR: i64 = -32002;
|
||||
pub const NO_NEW_WORK: i64 = -32003;
|
||||
pub const NO_WORK_REQUIRED: i64 = -32004;
|
||||
pub const UNKNOWN_ERROR: i64 = -32009;
|
||||
pub const TRANSACTION_ERROR: i64 = -32010;
|
||||
pub const EXECUTION_ERROR: i64 = -32015;
|
||||
@@ -133,7 +134,7 @@ pub fn state_pruned() -> Error {
|
||||
Error {
|
||||
code: ErrorCode::ServerError(codes::UNSUPPORTED_REQUEST),
|
||||
message: "This request is not supported because your node is running with state pruning. Run with --pruning=archive.".into(),
|
||||
data: None
|
||||
data: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +146,7 @@ pub fn exceptional() -> Error {
|
||||
Error {
|
||||
code: ErrorCode::ServerError(codes::EXCEPTION_ERROR),
|
||||
message: "The execution failed due to an exception.".into(),
|
||||
data: None
|
||||
data: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +154,7 @@ pub fn no_work() -> Error {
|
||||
Error {
|
||||
code: ErrorCode::ServerError(codes::NO_WORK),
|
||||
message: "Still syncing.".into(),
|
||||
data: None
|
||||
data: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +162,7 @@ pub fn no_new_work() -> Error {
|
||||
Error {
|
||||
code: ErrorCode::ServerError(codes::NO_NEW_WORK),
|
||||
message: "Work has not changed.".into(),
|
||||
data: None
|
||||
data: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +170,15 @@ pub fn no_author() -> Error {
|
||||
Error {
|
||||
code: ErrorCode::ServerError(codes::NO_AUTHOR),
|
||||
message: "Author not configured. Run Parity with --author to configure.".into(),
|
||||
data: None
|
||||
data: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn no_work_required() -> Error {
|
||||
Error {
|
||||
code: ErrorCode::ServerError(codes::NO_WORK_REQUIRED),
|
||||
message: "External work is only required for Proof of Work engines.".into(),
|
||||
data: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user