@@ -14,16 +14,11 @@ pub(crate) mod utils;
1414
1515use bitcoin:: secp256k1:: { self , PublicKey , Secp256k1 , SecretKey } ;
1616
17- use crate :: sign:: { EntropySource , NodeSigner , Recipient } ;
18- use crate :: onion_message:: ControlTlvs ;
17+ use crate :: sign:: EntropySource ;
1918use crate :: ln:: msgs:: DecodeError ;
20- use crate :: ln:: onion_utils;
21- use crate :: util:: chacha20poly1305rfc:: ChaChaPolyReadAdapter ;
22- use crate :: util:: ser:: { FixedLengthReader , LengthReadableArgs , Readable , Writeable , Writer } ;
19+ use crate :: util:: ser:: { Readable , Writeable , Writer } ;
2320
24- use core:: mem;
25- use core:: ops:: Deref ;
26- use crate :: io:: { self , Cursor } ;
21+ use crate :: io;
2722use crate :: prelude:: * ;
2823
2924/// Onion messages and payments can be sent and received to blinded paths, which serve to hide the
@@ -77,36 +72,6 @@ impl BlindedPath {
7772 blinded_hops : message:: blinded_hops ( secp_ctx, node_pks, & blinding_secret) . map_err ( |_| ( ) ) ?,
7873 } )
7974 }
80-
81- // Advance the blinded onion message path by one hop, so make the second hop into the new
82- // introduction node.
83- pub ( super ) fn advance_message_path_by_one < NS : Deref , T : secp256k1:: Signing + secp256k1:: Verification >
84- ( & mut self , node_signer : & NS , secp_ctx : & Secp256k1 < T > ) -> Result < ( ) , ( ) >
85- where NS :: Target : NodeSigner
86- {
87- let control_tlvs_ss = node_signer. ecdh ( Recipient :: Node , & self . blinding_point , None ) ?;
88- let rho = onion_utils:: gen_rho_from_shared_secret ( & control_tlvs_ss. secret_bytes ( ) ) ;
89- let encrypted_control_tlvs = self . blinded_hops . remove ( 0 ) . encrypted_payload ;
90- let mut s = Cursor :: new ( & encrypted_control_tlvs) ;
91- let mut reader = FixedLengthReader :: new ( & mut s, encrypted_control_tlvs. len ( ) as u64 ) ;
92- match ChaChaPolyReadAdapter :: read ( & mut reader, rho) {
93- Ok ( ChaChaPolyReadAdapter { readable : ControlTlvs :: Forward ( message:: ForwardTlvs {
94- mut next_node_id, next_blinding_override,
95- } ) } ) => {
96- let mut new_blinding_point = match next_blinding_override {
97- Some ( blinding_point) => blinding_point,
98- None => {
99- onion_utils:: next_hop_pubkey ( secp_ctx, self . blinding_point ,
100- control_tlvs_ss. as_ref ( ) ) . map_err ( |_| ( ) ) ?
101- }
102- } ;
103- mem:: swap ( & mut self . blinding_point , & mut new_blinding_point) ;
104- mem:: swap ( & mut self . introduction_node_id , & mut next_node_id) ;
105- Ok ( ( ) )
106- } ,
107- _ => Err ( ( ) )
108- }
109- }
11075}
11176
11277impl Writeable for BlindedPath {
0 commit comments