| 306 | |
| 307 | impl PolicyOpeningFeeParams { |
| 308 | pub fn get_hmac_hex(&self, secret: &[u8]) -> String { |
| 309 | let mut hmac = HmacEngine::<sha256::Hash>::new(&secret); |
| 310 | hmac.input(&self.min_fee_msat.msat().to_be_bytes()); |
| 311 | hmac.input(&self.proportional.ppm().to_be_bytes()); |
| 312 | hmac.input(self.valid_until.to_rfc3339().as_bytes()); |
| 313 | hmac.input(&self.min_lifetime.to_be_bytes()); |
| 314 | hmac.input(&self.max_client_to_self_delay.to_be_bytes()); |
| 315 | hmac.input(&self.min_payment_size_msat.msat().to_be_bytes()); |
| 316 | hmac.input(&self.max_payment_size_msat.msat().to_be_bytes()); |
| 317 | let promise = Hmac::from_engine(hmac) |
| 318 | .to_byte_array() |
| 319 | .iter() |
| 320 | .map(|b| format!("{:02x}", b)) |
| 321 | .collect(); |
| 322 | promise |
| 323 | } |
| 324 | |
| 325 | pub fn with_promise(&self, secret: &[u8; 32]) -> OpeningFeeParams { |
| 326 | OpeningFeeParams { |