| 349 | |
| 350 | #[test] |
| 351 | fn test_commitment_revocation_hook() { |
| 352 | let r = serde_json::json!({ |
| 353 | "commitment_txid": "58eea2cf538cfed79f4d6b809b920b40bb6b35962c4bb4cc81f5550a7728ab05", |
| 354 | "penalty_tx": "02000000000101...ac00000000", |
| 355 | "channel_id": "fb16398de93e8690c665873715ef590c038dfac5dd6c49a9d4b61dccfcedc2fb", |
| 356 | "commitnum": 21 |
| 357 | }); |
| 358 | let d: CommitmentRevocationEvent = serde_json::from_value(r).unwrap(); |
| 359 | assert_eq!( |
| 360 | d.commitment_txid, |
| 361 | "58eea2cf538cfed79f4d6b809b920b40bb6b35962c4bb4cc81f5550a7728ab05" |
| 362 | ); |
| 363 | assert_eq!(d.penalty_tx, "02000000000101...ac00000000"); |
| 364 | assert_eq!( |
| 365 | d.channel_id.to_string(), |
| 366 | "fb16398de93e8690c665873715ef590c038dfac5dd6c49a9d4b61dccfcedc2fb" |
| 367 | ); |
| 368 | assert_eq!(d.commitnum, 21); |
| 369 | assert_serde_roundtrip!(d, CommitmentRevocationEvent); |
| 370 | } |
| 371 | |
| 372 | #[test] |
| 373 | fn test_db_write_hook() { |