mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
cln-plugin: Make rpcmethod handlers async
This commit is contained in:
committed by
Rusty Russell
parent
60e773239c
commit
a7ef38732f
@@ -13,15 +13,15 @@ async fn main() -> Result<(), anyhow::Error> {
|
||||
options::Value::Integer(42),
|
||||
"a test-option with default 42",
|
||||
))
|
||||
.rpcmethod("testmethod", "This is a test", Box::new(testmethod))
|
||||
.rpcmethod("testmethod", "This is a test", testmethod)
|
||||
.subscribe("connect", Box::new(connect_handler))
|
||||
.hook("peer_connected", Box::new(peer_connected_handler))
|
||||
//.hook("peer_connected", Box::new(peer_connected_handler))
|
||||
.start()
|
||||
.await?;
|
||||
plugin.join().await
|
||||
}
|
||||
|
||||
fn testmethod(_p: Plugin<()>, _v: &serde_json::Value) -> Result<serde_json::Value, Error> {
|
||||
async fn testmethod(_p: Plugin<()>, _v: serde_json::Value) -> Result<serde_json::Value, Error> {
|
||||
Ok(json!("Hello"))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user