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

Function main

plugins/bip353-plugin/src/main.rs:17–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15
16#[tokio::main(flavor = "current_thread")]
17async fn main() -> Result<(), anyhow::Error> {
18 unsafe {
19 // SAFETY:
20 // `std::env::set_var` is unsafe in Rust 2024 because environment variables
21 // are process-global and unsynchronized. Concurrent reads/writes from
22 // multiple threads can cause undefined behavior.
23 //
24 // This call happens at process startup, before any threads are spawned and
25 // before any code that may read environment variables is executed.
26 // Therefore, no concurrent access is possible.
27 std::env::set_var(
28 "CLN_PLUGIN_LOG",
29 "cln_plugin=info,cln_rpc=info,cln_bip353=trace,warn",
30 )
31 };
32
33 log_panics::init();
34
35 let plugin = match Builder::new(tokio::io::stdin(), tokio::io::stdout())
36 .rpcmethod_from_builder(
37 RpcMethodBuilder::new("fetchbip353", fetch_bip353)
38 .description("Fetch bip353 data and proofs")
39 .usage("[address]"),
40 )
41 .dynamic()
42 .configure()
43 .await?
44 {
45 Some(p) => p,
46 None => return Ok(()),
47 };
48
49 let plugin = plugin.start(()).await?;
50
51 plugin.join().await
52}
53
54#[derive(Debug, Serialize)]
55struct ProcessedBIP353 {

Callers

nothing calls this directly

Calls 8

configureMethod · 0.80
usageMethod · 0.80
joinMethod · 0.80
initFunction · 0.50
dynamicMethod · 0.45
descriptionMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected