Skip to content

Commit bd4d7a1

Browse files
committed
test(rpcserver): Integration test asserting behavior against jsonrpc requests cases.
The last commit presented some changes for the rpcserver and these tests assert them.
1 parent 6dfdabb commit bd4d7a1

File tree

3 files changed

+587
-4
lines changed

3 files changed

+587
-4
lines changed

crates/floresta-node/src/json_rpc/server.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ use tracing::error;
4040
use tracing::info;
4141

4242
use super::res::jsonrpc_interface::JsonRpcError;
43-
use super::res::GetBlockRes;
4443
use super::res::RawTxJson;
4544
use super::res::ScriptPubKeyJson;
4645
use super::res::ScriptSigJson;
@@ -269,7 +268,10 @@ async fn handle_json_rpc_request(
269268
}
270269

271270
// Methods that require params
272-
let params = params.ok_or(JsonRpcError::MissingParameter("params".into()))?;
271+
//
272+
// We default here because theres some cases we have only optionals for a call, so even if omitted, is
273+
// nice for params to be Some(Value) even if this value is Null.
274+
let params = params.unwrap_or_default();
273275

274276
match method.as_str() {
275277
"getblock" => {

0 commit comments

Comments
 (0)