| 521 | |
| 522 | #[test] |
| 523 | fn test_sendpay_failure() { |
| 524 | let j: serde_json::Value = json!({ |
| 525 | "code": 204, |
| 526 | "message": "failed: WIRE_TEMPORARY_CHANNEL_FAILURE (reply from remote)", |
| 527 | "data": { |
| 528 | "created_index": 1, |
| 529 | "id": 1, |
| 530 | "payment_hash": "d17a42c4f7f49648064a0ce7ce848bd92c4c50f24d35fe5c3d1f3a7a9bf474b2", |
| 531 | "groupid": 1, |
| 532 | "updated_index": 1, |
| 533 | "partid": 0, |
| 534 | "destination": "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d", |
| 535 | "amount_msat": "10000msat", |
| 536 | "amount_sent_msat": "10001msat", |
| 537 | "created_at": 1648222556, |
| 538 | "completed_at": 1648222557, |
| 539 | "status": "failed", |
| 540 | "erring_index": 1, |
| 541 | "failcode": 8195, |
| 542 | "failcodename": "WIRE_TEMPORARY_CHANNEL_FAILURE", |
| 543 | "erring_node": "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d", |
| 544 | "erring_channel": "103x2x1", |
| 545 | "erring_direction": 0, |
| 546 | "bolt11": "lnbcrt100n1p3...", |
| 547 | "label": "test-payment-1" |
| 548 | } |
| 549 | }); |
| 550 | let u: cln_rpc::notifications::SendPayFailureNotification = serde_json::from_value(j).unwrap(); |
| 551 | assert_eq!(u.code, 204); |
| 552 | assert_eq!( |
| 553 | u.data.status, |
| 554 | Some(cln_rpc::notifications::SendpayFailureDataStatus::FAILED) |
| 555 | ); |
| 556 | assert_eq!(u.data.failcode, Some(8195)); |
| 557 | assert_eq!(u.data.erring_direction, Some(0)); |
| 558 | let _pb: crate::pb::SendPayFailureNotification = u.into(); |
| 559 | } |
| 560 | |
| 561 | #[test] |
| 562 | fn test_sendpay_success() { |