projects
/
rust-lightning
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0624cf9
)
Expose onion message module as public
author
Valentine Wallace
<vwallace@protonmail.com>
Wed, 3 Aug 2022 15:42:54 +0000
(11:42 -0400)
committer
Valentine Wallace
<vwallace@protonmail.com>
Fri, 2 Sep 2022 20:25:32 +0000
(16:25 -0400)
And fix warnings
lightning/src/lib.rs
patch
|
blob
|
history
lightning/src/onion_message/functional_tests.rs
patch
|
blob
|
history
lightning/src/onion_message/messenger.rs
patch
|
blob
|
history
lightning/src/onion_message/packet.rs
patch
|
blob
|
history
diff --git
a/lightning/src/lib.rs
b/lightning/src/lib.rs
index 199a3cbee4b807e31e78b6e619d263772fce0bc9..1000966d5a5b8ecca943fc7b7c2ef9642b027b9b 100644
(file)
--- a/
lightning/src/lib.rs
+++ b/
lightning/src/lib.rs
@@
-79,11
+79,7
@@
pub mod util;
pub mod chain;
pub mod ln;
pub mod routing;
pub mod chain;
pub mod ln;
pub mod routing;
-#[cfg(fuzzing)]
pub mod onion_message;
pub mod onion_message;
-#[cfg(not(fuzzing))]
-#[allow(unused)]
-mod onion_message; // To be exposed after sending/receiving OMs is supported in PeerManager.
#[cfg(feature = "std")]
/// Re-export of either `core2::io` or `std::io`, depending on the `std` feature flag.
#[cfg(feature = "std")]
/// Re-export of either `core2::io` or `std::io`, depending on the `std` feature flag.
diff --git
a/lightning/src/onion_message/functional_tests.rs
b/lightning/src/onion_message/functional_tests.rs
index 5a83a0b2b213939822a09c0b29e0d50deec345ad..001d96e834264c68ae8e467b8a024e471d923dcc 100644
(file)
--- a/
lightning/src/onion_message/functional_tests.rs
+++ b/
lightning/src/onion_message/functional_tests.rs
@@
-124,7
+124,7
@@
fn too_big_packet_error() {
#[test]
fn invalid_blinded_route_error() {
// Make sure we error as expected if a provided blinded route has 0 or 1 hops.
#[test]
fn invalid_blinded_route_error() {
// Make sure we error as expected if a provided blinded route has 0 or 1 hops.
- let
mut
nodes = create_nodes(3);
+ let nodes = create_nodes(3);
// 0 hops
let secp_ctx = Secp256k1::new();
// 0 hops
let secp_ctx = Secp256k1::new();
@@
-143,7
+143,7
@@
fn invalid_blinded_route_error() {
#[test]
fn reply_path() {
#[test]
fn reply_path() {
- let
mut
nodes = create_nodes(4);
+ let nodes = create_nodes(4);
let secp_ctx = Secp256k1::new();
// Destination::Node
let secp_ctx = Secp256k1::new();
// Destination::Node
diff --git
a/lightning/src/onion_message/messenger.rs
b/lightning/src/onion_message/messenger.rs
index 75eb4619b8f913aa667011d29cb2ff5451c33eef..3a14c78d0fba724a6517776352d37fdefc6244bf 100644
(file)
--- a/
lightning/src/onion_message/messenger.rs
+++ b/
lightning/src/onion_message/messenger.rs
@@
-24,7
+24,6
@@
use super::utils;
use util::events::OnionMessageProvider;
use util::logger::Logger;
use util::events::OnionMessageProvider;
use util::logger::Logger;
-use core::mem;
use core::ops::Deref;
use sync::{Arc, Mutex};
use prelude::*;
use core::ops::Deref;
use sync::{Arc, Mutex};
use prelude::*;
@@
-35,9
+34,7
@@
use prelude::*;
///
/// # Example
///
///
/// # Example
///
-// Needs to be `ignore` until the `onion_message` module is made public, otherwise this is a test
-// failure.
-/// ```ignore
+/// ```
/// # extern crate bitcoin;
/// # use bitcoin::hashes::_export::_core::time::Duration;
/// # use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey};
/// # extern crate bitcoin;
/// # use bitcoin::hashes::_export::_core::time::Duration;
/// # use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey};
@@
-66,7
+63,8
@@
use prelude::*;
///
/// // Send an empty onion message to a node id.
/// let intermediate_hops = [hop_node_id1, hop_node_id2];
///
/// // Send an empty onion message to a node id.
/// let intermediate_hops = [hop_node_id1, hop_node_id2];
-/// onion_messenger.send_onion_message(&intermediate_hops, Destination::Node(destination_node_id));
+/// let reply_path = None;
+/// onion_messenger.send_onion_message(&intermediate_hops, Destination::Node(destination_node_id), reply_path);
///
/// // Create a blinded route to yourself, for someone to send an onion message to.
/// # let your_node_id = hop_node_id1;
///
/// // Create a blinded route to yourself, for someone to send an onion message to.
/// # let your_node_id = hop_node_id1;
@@
-75,7
+73,8
@@
use prelude::*;
///
/// // Send an empty onion message to a blinded route.
/// # let intermediate_hops = [hop_node_id1, hop_node_id2];
///
/// // Send an empty onion message to a blinded route.
/// # let intermediate_hops = [hop_node_id1, hop_node_id2];
-/// onion_messenger.send_onion_message(&intermediate_hops, Destination::BlindedRoute(blinded_route));
+/// let reply_path = None;
+/// onion_messenger.send_onion_message(&intermediate_hops, Destination::BlindedRoute(blinded_route), reply_path);
/// ```
///
/// [offers]: <https://github.com/lightning/bolts/pull/798>
/// ```
///
/// [offers]: <https://github.com/lightning/bolts/pull/798>
diff --git
a/lightning/src/onion_message/packet.rs
b/lightning/src/onion_message/packet.rs
index 4ab53735ed6f8c9fc132d13dd80fc61628319f35..1337bdb14d5d6c3bf83fcadc5beebcea8b6d70d8 100644
(file)
--- a/
lightning/src/onion_message/packet.rs
+++ b/
lightning/src/onion_message/packet.rs
@@
-74,7
+74,7
@@
impl LengthReadable for Packet {
while read_idx < hop_data_len {
let mut read_buffer = [0; READ_BUFFER_SIZE];
let read_amt = cmp::min(hop_data_len - read_idx, READ_BUFFER_SIZE);
while read_idx < hop_data_len {
let mut read_buffer = [0; READ_BUFFER_SIZE];
let read_amt = cmp::min(hop_data_len - read_idx, READ_BUFFER_SIZE);
- r.read_exact(&mut read_buffer[..read_amt]);
+ r.read_exact(&mut read_buffer[..read_amt])
?
;
hop_data.extend_from_slice(&read_buffer[..read_amt]);
read_idx += read_amt;
}
hop_data.extend_from_slice(&read_buffer[..read_amt]);
read_idx += read_amt;
}
@@
-170,7
+170,7
@@
impl Writeable for (Payload, [u8; 32]) {
// Uses the provided secret to simultaneously decode and decrypt the control TLVs.
impl ReadableArgs<SharedSecret> for Payload {
// Uses the provided secret to simultaneously decode and decrypt the control TLVs.
impl ReadableArgs<SharedSecret> for Payload {
- fn read<R: Read>(
mut
r: &mut R, encrypted_tlvs_ss: SharedSecret) -> Result<Self, DecodeError> {
+ fn read<R: Read>(r: &mut R, encrypted_tlvs_ss: SharedSecret) -> Result<Self, DecodeError> {
let v: BigSize = Readable::read(r)?;
let mut rd = FixedLengthReader::new(r, v.0);
let mut reply_path: Option<BlindedRoute> = None;
let v: BigSize = Readable::read(r)?;
let mut rd = FixedLengthReader::new(r, v.0);
let mut reply_path: Option<BlindedRoute> = None;