projects
/
rust-lightning
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
(Very) marginally expand `test_monitor_update_fail_claim`
[rust-lightning]
/
lightning
/
src
/
offers
/
test_utils.rs
diff --git
a/lightning/src/offers/test_utils.rs
b/lightning/src/offers/test_utils.rs
index f1b3c79edc0ec15cd5f68a406c5f6a8e7f7c3f91..0c35ee2859878a7bb98171481b5c1fc4132fed2b 100644
(file)
--- a/
lightning/src/offers/test_utils.rs
+++ b/
lightning/src/offers/test_utils.rs
@@
-9,44
+9,51
@@
//! Utilities for testing BOLT 12 Offers interfaces
//! Utilities for testing BOLT 12 Offers interfaces
-use bitcoin::secp256k1::{Key
P
air, PublicKey, Secp256k1, SecretKey};
+use bitcoin::secp256k1::{Key
p
air, PublicKey, Secp256k1, SecretKey};
use bitcoin::secp256k1::schnorr::Signature;
use bitcoin::secp256k1::schnorr::Signature;
-use core::convert::{AsRef, Infallible};
+
use core::time::Duration;
use core::time::Duration;
-use crate::blinded_path::{BlindedHop, BlindedPath};
+use crate::blinded_path::{BlindedHop, BlindedPath
, IntroductionNode
};
use crate::sign::EntropySource;
use crate::sign::EntropySource;
-use crate::ln::PaymentHash;
+use crate::ln::
types::
PaymentHash;
use crate::ln::features::BlindedHopFeatures;
use crate::offers::invoice::BlindedPayInfo;
use crate::offers::merkle::TaggedHash;
use crate::ln::features::BlindedHopFeatures;
use crate::offers::invoice::BlindedPayInfo;
use crate::offers::merkle::TaggedHash;
-pub(super) fn payer_keys() -> KeyPair {
+#[allow(unused_imports)]
+use crate::prelude::*;
+
+pub(crate) fn fail_sign<T: AsRef<TaggedHash>>(_message: &T) -> Result<Signature, ()> {
+ Err(())
+}
+
+pub(crate) fn payer_keys() -> Keypair {
let secp_ctx = Secp256k1::new();
let secp_ctx = Secp256k1::new();
- Key
P
air::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[42; 32]).unwrap())
+ Key
p
air::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[42; 32]).unwrap())
}
}
-pub(
super) fn payer_sign<T: AsRef<TaggedHash>>(message: &T) -> Result<Signature, Infallible
> {
+pub(
crate) fn payer_sign<T: AsRef<TaggedHash>>(message: &T) -> Result<Signature, ()
> {
let secp_ctx = Secp256k1::new();
let secp_ctx = Secp256k1::new();
- let keys = Key
P
air::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[42; 32]).unwrap());
+ let keys = Key
p
air::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[42; 32]).unwrap());
Ok(secp_ctx.sign_schnorr_no_aux_rand(message.as_ref().as_digest(), &keys))
}
Ok(secp_ctx.sign_schnorr_no_aux_rand(message.as_ref().as_digest(), &keys))
}
-pub(
super
) fn payer_pubkey() -> PublicKey {
+pub(
crate
) fn payer_pubkey() -> PublicKey {
payer_keys().public_key()
}
payer_keys().public_key()
}
-pub(
super) fn recipient_keys() -> KeyP
air {
+pub(
crate) fn recipient_keys() -> Keyp
air {
let secp_ctx = Secp256k1::new();
let secp_ctx = Secp256k1::new();
- Key
P
air::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[43; 32]).unwrap())
+ Key
p
air::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[43; 32]).unwrap())
}
}
-pub(
super) fn recipient_sign<T: AsRef<TaggedHash>>(message: &T) -> Result<Signature, Infallible
> {
+pub(
crate) fn recipient_sign<T: AsRef<TaggedHash>>(message: &T) -> Result<Signature, ()
> {
let secp_ctx = Secp256k1::new();
let secp_ctx = Secp256k1::new();
- let keys = Key
P
air::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[43; 32]).unwrap());
+ let keys = Key
p
air::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[43; 32]).unwrap());
Ok(secp_ctx.sign_schnorr_no_aux_rand(message.as_ref().as_digest(), &keys))
}
Ok(secp_ctx.sign_schnorr_no_aux_rand(message.as_ref().as_digest(), &keys))
}
-pub(
super
) fn recipient_pubkey() -> PublicKey {
+pub(
crate
) fn recipient_pubkey() -> PublicKey {
recipient_keys().public_key()
}
recipient_keys().public_key()
}
@@
-59,10
+66,10
@@
pub(super) fn privkey(byte: u8) -> SecretKey {
SecretKey::from_slice(&[byte; 32]).unwrap()
}
SecretKey::from_slice(&[byte; 32]).unwrap()
}
-pub(
super
) fn payment_paths() -> Vec<(BlindedPayInfo, BlindedPath)> {
+pub(
crate
) fn payment_paths() -> Vec<(BlindedPayInfo, BlindedPath)> {
let paths = vec![
BlindedPath {
let paths = vec![
BlindedPath {
- introduction_node
_id: pubkey(40
),
+ introduction_node
: IntroductionNode::NodeId(pubkey(40)
),
blinding_point: pubkey(41),
blinded_hops: vec![
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 43] },
blinding_point: pubkey(41),
blinded_hops: vec![
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 43] },
@@
-70,7
+77,7
@@
pub(super) fn payment_paths() -> Vec<(BlindedPayInfo, BlindedPath)> {
],
},
BlindedPath {
],
},
BlindedPath {
- introduction_node
_id: pubkey(40
),
+ introduction_node
: IntroductionNode::NodeId(pubkey(40)
),
blinding_point: pubkey(41),
blinded_hops: vec![
BlindedHop { blinded_node_id: pubkey(45), encrypted_payload: vec![0; 45] },
blinding_point: pubkey(41),
blinded_hops: vec![
BlindedHop { blinded_node_id: pubkey(45), encrypted_payload: vec![0; 45] },
@@
-101,17
+108,17
@@
pub(super) fn payment_paths() -> Vec<(BlindedPayInfo, BlindedPath)> {
payinfo.into_iter().zip(paths.into_iter()).collect()
}
payinfo.into_iter().zip(paths.into_iter()).collect()
}
-pub(
super
) fn payment_hash() -> PaymentHash {
+pub(
crate
) fn payment_hash() -> PaymentHash {
PaymentHash([42; 32])
}
PaymentHash([42; 32])
}
-pub(
super
) fn now() -> Duration {
+pub(
crate
) fn now() -> Duration {
std::time::SystemTime::now()
.duration_since(std::time::SystemTime::UNIX_EPOCH)
.expect("SystemTime::now() should come after SystemTime::UNIX_EPOCH")
}
std::time::SystemTime::now()
.duration_since(std::time::SystemTime::UNIX_EPOCH)
.expect("SystemTime::now() should come after SystemTime::UNIX_EPOCH")
}
-pub(
super
) struct FixedEntropy;
+pub(
crate
) struct FixedEntropy;
impl EntropySource for FixedEntropy {
fn get_secure_random_bytes(&self) -> [u8; 32] {
impl EntropySource for FixedEntropy {
fn get_secure_random_bytes(&self) -> [u8; 32] {