MCPcopy Create free account
hub / github.com/ElementsProject/lightning / merge_maps_disjoint

Function merge_maps_disjoint

plugins/rest-plugin/src/handlers.rs:290–305  ·  view source on GitHub ↗
(
    base: &mut serde_json::Map<String, serde_json::Value>,
    other: serde_json::Map<String, serde_json::Value>,
)

Source from the content-addressed store, hash-verified

288}
289
290fn merge_maps_disjoint(
291 base: &mut serde_json::Map<String, serde_json::Value>,
292 other: serde_json::Map<String, serde_json::Value>,
293) -> Result<(), AppError> {
294 for (key, value) in other {
295 if base.contains_key(&key) {
296 return Err(AppError::NotAcceptable(RpcError {
297 code: None,
298 message: format!("Duplicate key: {key}"),
299 data: None,
300 }));
301 }
302 base.insert(key, value);
303 }
304 Ok(())
305}
306
307fn convert_json_to_response(
308 headers: axum::http::HeaderMap,

Callers 1

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected