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

Function test_keysend

cln-grpc/src/test.rs:261–325  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

259#[cfg(feature = "server")]
260#[test]
261fn test_keysend() {
262 let g =
263 KeysendRequest {
264 destination: hex::decode(
265 "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d",
266 )
267 .unwrap(),
268 amount_msat: Some(Amount { msat: 10000 }),
269
270 label: Some("hello".to_string()),
271 exemptfee: None,
272 maxdelay: None,
273 retry_for: None,
274 maxfeepercent: None,
275 routehints: Some(RoutehintList {
276 hints: vec![Routehint {
277 hops: vec![RouteHop {
278 id: hex::decode(
279 "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d",
280 )
281 .unwrap(),
282 scid: "12345x678x90".to_string(),
283 feebase: Some(Amount { msat: 123 }),
284 feeprop: 1234,
285 expirydelta: 9,
286 },RouteHop {
287 id: hex::decode(
288 "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d",
289 )
290 .unwrap(),
291 scid: "12345x678x90".to_string(),
292 feebase: Some(Amount { msat: 123 }),
293 feeprop: 1234,
294 expirydelta: 9,
295 }],
296 }],
297 }),
298 extratlvs: None,
299 maxfee: None,
300 };
301
302 let u: cln_rpc::model::requests::KeysendRequest = g.into();
303 let _ser = serde_json::to_string(&u);
304
305 let j = r#"{
306 "destination": "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d",
307 "payment_hash": "e74b03a98453dcb5a7ed5406b97ec3566dde4be85ef71685110f4c0ebc600592",
308 "created_at": 1648222556.498,
309 "parts": 1,
310 "msatoshi": 10000,
311 "amount_msat": "10000msat",
312 "msatoshi_sent": 10001,
313 "amount_sent_msat": "10001msat",
314 "payment_preimage": "e56c22b9ed85560b021e1577daad5742502d25c0c2f636b817f5c0c7580a66a8",
315 "status": "complete"
316 }"#;
317 let u: cln_rpc::model::responses::KeysendResponse = serde_json::from_str(j).unwrap();
318 let g: KeysendResponse = u.clone().into();

Callers

nothing calls this directly

Calls 4

decodeFunction · 0.50
to_stringFunction · 0.50
unwrapMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected