X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Foffers%2Ftest_utils.rs;h=230c6aa1628d96a180276d228d5742369062886f;hb=83f0dbc0021335dce183450d7dce7e9f284ff0b6;hp=7447b86fb84f3409c758cd485cd291067dad2183;hpb=ce7a02d1e002e5047aa1bf56a0176d85d8a5bde3;p=rust-lightning diff --git a/lightning/src/offers/test_utils.rs b/lightning/src/offers/test_utils.rs index 7447b86f..230c6aa1 100644 --- a/lightning/src/offers/test_utils.rs +++ b/lightning/src/offers/test_utils.rs @@ -13,10 +13,11 @@ use bitcoin::secp256k1::{KeyPair, Message, PublicKey, Secp256k1, SecretKey}; use bitcoin::secp256k1::schnorr::Signature; use core::convert::Infallible; use core::time::Duration; +use crate::blinded_path::{BlindedHop, BlindedPath}; +use crate::sign::EntropySource; use crate::ln::PaymentHash; use crate::ln::features::BlindedHopFeatures; use crate::offers::invoice::BlindedPayInfo; -use crate::onion_message::{BlindedHop, BlindedPath}; pub(super) fn payer_keys() -> KeyPair { let secp_ctx = Secp256k1::new(); @@ -57,7 +58,7 @@ pub(super) fn privkey(byte: u8) -> SecretKey { SecretKey::from_slice(&[byte; 32]).unwrap() } -pub(super) fn payment_paths() -> Vec<(BlindedPath, BlindedPayInfo)> { +pub(super) fn payment_paths() -> Vec<(BlindedPayInfo, BlindedPath)> { let paths = vec![ BlindedPath { introduction_node_id: pubkey(40), @@ -96,7 +97,7 @@ pub(super) fn payment_paths() -> Vec<(BlindedPath, BlindedPayInfo)> { }, ]; - paths.into_iter().zip(payinfo.into_iter()).collect() + payinfo.into_iter().zip(paths.into_iter()).collect() } pub(super) fn payment_hash() -> PaymentHash { @@ -108,3 +109,11 @@ pub(super) fn now() -> Duration { .duration_since(std::time::SystemTime::UNIX_EPOCH) .expect("SystemTime::now() should come after SystemTime::UNIX_EPOCH") } + +pub(super) struct FixedEntropy; + +impl EntropySource for FixedEntropy { + fn get_secure_random_bytes(&self) -> [u8; 32] { + [42; 32] + } +}