mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-22 16:44:20 +01:00
cln-rpc: allow id to be any token.
Suggested-by: @cdecker Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -364,7 +364,7 @@ pub struct ConfiguredPlugin<S, I, O>
|
||||
where
|
||||
S: Clone + Send,
|
||||
{
|
||||
init_id: usize,
|
||||
init_id: serde_json::Value,
|
||||
input: FramedRead<I, JsonRpcCodec>,
|
||||
output: Arc<Mutex<FramedWrite<O, JsonCodec>>>,
|
||||
plugin: Plugin<S>,
|
||||
@@ -543,7 +543,7 @@ where
|
||||
self.dispatch_notification(n, plugin).await
|
||||
}
|
||||
messages::JsonRpc::CustomRequest(id, p) => {
|
||||
match self.dispatch_custom_request(id, p, plugin).await {
|
||||
match self.dispatch_custom_request(id.clone(), p, plugin).await {
|
||||
Ok(v) => plugin
|
||||
.sender
|
||||
.send(json!({
|
||||
@@ -575,7 +575,7 @@ where
|
||||
}
|
||||
|
||||
async fn dispatch_request(
|
||||
_id: usize,
|
||||
_id: serde_json::Value,
|
||||
_request: messages::Request,
|
||||
_plugin: &Plugin<S>,
|
||||
) -> Result<(), Error> {
|
||||
@@ -595,7 +595,7 @@ where
|
||||
|
||||
async fn dispatch_custom_request(
|
||||
&self,
|
||||
_id: usize,
|
||||
_id: serde_json::Value,
|
||||
request: serde_json::Value,
|
||||
plugin: &Plugin<S>,
|
||||
) -> Result<serde_json::Value, Error> {
|
||||
|
||||
@@ -94,9 +94,9 @@ pub struct ProxyInfo {
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum JsonRpc<N, R> {
|
||||
Request(usize, R),
|
||||
Request(serde_json::Value, R),
|
||||
Notification(N),
|
||||
CustomRequest(usize, Value),
|
||||
CustomRequest(serde_json::Value, Value),
|
||||
CustomNotification(Value),
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ where
|
||||
{
|
||||
#[derive(Deserialize, Debug)]
|
||||
struct IdHelper {
|
||||
id: Option<usize>,
|
||||
id: Option<serde_json::Value>,
|
||||
}
|
||||
|
||||
let v = Value::deserialize(deserializer)?;
|
||||
@@ -203,7 +203,7 @@ mod test {
|
||||
"always_use_proxy": false
|
||||
}
|
||||
},
|
||||
"id": 10,
|
||||
"id": "10",
|
||||
});
|
||||
let req: JsonRpc<Notification, Request> = serde_json::from_value(value).unwrap();
|
||||
match req {
|
||||
|
||||
Reference in New Issue
Block a user