Add CIDv0 RPC (#5414)

* add cid rpc

* add light

* clean up
This commit is contained in:
keorn
2017-04-08 12:35:23 +01:00
committed by Gav Wood
parent bca0c6c172
commit 20d4e7139f
10 changed files with 82 additions and 2 deletions

View File

@@ -44,6 +44,7 @@ mod codes {
pub const REQUEST_REJECTED_LIMIT: i64 = -32041;
pub const REQUEST_NOT_FOUND: i64 = -32042;
pub const ENCRYPTION_ERROR: i64 = -32055;
pub const ENCODING_ERROR: i64 = -32058;
pub const FETCH_ERROR: i64 = -32060;
pub const NO_LIGHT_PEERS: i64 = -32065;
pub const DEPRECATED: i64 = -32070;
@@ -224,6 +225,14 @@ pub fn encryption_error<T: fmt::Debug>(error: T) -> Error {
}
}
pub fn encoding_error<T: fmt::Debug>(error: T) -> Error {
Error {
code: ErrorCode::ServerError(codes::ENCODING_ERROR),
message: "Encoding error.".into(),
data: Some(Value::String(format!("{:?}", error))),
}
}
pub fn database_error<T: fmt::Debug>(error: T) -> Error {
Error {
code: ErrorCode::ServerError(codes::DATABASE_ERROR),