26
26
//! [`send_payment`], etc.:
27
27
//!
28
28
//! ```no_run
29
- //! use ldk_node::{Builder, NetAddress };
29
+ //! use ldk_node::{Builder, SocketAddress };
30
30
//! use ldk_node::lightning_invoice::Bolt11Invoice;
31
31
//! use ldk_node::bitcoin::secp256k1::PublicKey;
32
32
//! use ldk_node::bitcoin::Network;
47
47
//! // .. fund address ..
48
48
//!
49
49
//! let node_id = PublicKey::from_str("NODE_ID").unwrap();
50
- //! let node_addr = NetAddress ::from_str("IP_ADDR:PORT").unwrap();
50
+ //! let node_addr = SocketAddress ::from_str("IP_ADDR:PORT").unwrap();
51
51
//! node.connect_open_channel(node_id, node_addr, 10000, None, None, false).unwrap();
52
52
//!
53
53
//! let event = node.wait_next_event();
@@ -100,7 +100,7 @@ use error::Error;
100
100
101
101
pub use event:: Event ;
102
102
pub use types:: ChannelConfig ;
103
- pub use types:: NetAddress ;
103
+ pub use types:: SocketAddress ;
104
104
105
105
pub use io:: utils:: generate_entropy_mnemonic;
106
106
@@ -225,7 +225,7 @@ pub struct Config {
225
225
/// The used Bitcoin network.
226
226
pub network : Network ,
227
227
/// The IP address and TCP port the node will listen on.
228
- pub listening_address : Option < NetAddress > ,
228
+ pub listening_address : Option < SocketAddress > ,
229
229
/// The default CLTV expiry delta to be used for payments.
230
230
pub default_cltv_expiry_delta : u32 ,
231
231
/// The time in-between background sync attempts of the onchain wallet, in seconds.
@@ -504,7 +504,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
504
504
"Unable to resolve listing address: {:?}" ,
505
505
listening_address
506
506
) ;
507
- Error :: InvalidNetAddress
507
+ Error :: InvalidSocketAddress
508
508
} ) ?
509
509
. next ( )
510
510
. ok_or_else ( || {
@@ -513,7 +513,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
513
513
"Unable to resolve listing address: {:?}" ,
514
514
listening_address
515
515
) ;
516
- Error :: InvalidNetAddress
516
+ Error :: InvalidSocketAddress
517
517
} ) ?;
518
518
519
519
runtime. spawn ( async move {
@@ -776,7 +776,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
776
776
}
777
777
778
778
/// Returns our own listening address.
779
- pub fn listening_address ( & self ) -> Option < NetAddress > {
779
+ pub fn listening_address ( & self ) -> Option < SocketAddress > {
780
780
self . config . listening_address . clone ( )
781
781
}
782
782
@@ -833,7 +833,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
833
833
///
834
834
/// If `persist` is set to `true`, we'll remember the peer and reconnect to it on restart.
835
835
pub fn connect (
836
- & self , node_id : PublicKey , address : NetAddress , persist : bool ,
836
+ & self , node_id : PublicKey , address : SocketAddress , persist : bool ,
837
837
) -> Result < ( ) , Error > {
838
838
let rt_lock = self . runtime . read ( ) . unwrap ( ) ;
839
839
if rt_lock. is_none ( ) {
@@ -898,7 +898,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
898
898
///
899
899
/// Returns a temporary channel id.
900
900
pub fn connect_open_channel (
901
- & self , node_id : PublicKey , address : NetAddress , channel_amount_sats : u64 ,
901
+ & self , node_id : PublicKey , address : SocketAddress , channel_amount_sats : u64 ,
902
902
push_to_counterparty_msat : Option < u64 > , channel_config : Option < Arc < ChannelConfig > > ,
903
903
announce_channel : bool ,
904
904
) -> Result < ( ) , Error > {
@@ -1536,7 +1536,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
1536
1536
let stored_peer = self . peer_store . get_peer ( & node_id) ;
1537
1537
let stored_addr_opt = stored_peer. as_ref ( ) . map ( |p| p. address . clone ( ) ) ;
1538
1538
let address = match ( con_addr_opt, stored_addr_opt) {
1539
- ( Some ( con_addr) , _) => NetAddress ( con_addr) ,
1539
+ ( Some ( con_addr) , _) => SocketAddress ( con_addr) ,
1540
1540
( None , Some ( stored_addr) ) => stored_addr,
1541
1541
( None , None ) => continue ,
1542
1542
} ;
@@ -1590,7 +1590,7 @@ impl<K: KVStore + Sync + Send + 'static> Drop for Node<K> {
1590
1590
}
1591
1591
1592
1592
async fn connect_peer_if_necessary < K : KVStore + Sync + Send + ' static > (
1593
- node_id : PublicKey , addr : NetAddress , peer_manager : Arc < PeerManager < K > > ,
1593
+ node_id : PublicKey , addr : SocketAddress , peer_manager : Arc < PeerManager < K > > ,
1594
1594
logger : Arc < FilesystemLogger > ,
1595
1595
) -> Result < ( ) , Error > {
1596
1596
for ( pman_node_id, _pman_addr) in peer_manager. get_peer_node_ids ( ) {
@@ -1603,7 +1603,7 @@ async fn connect_peer_if_necessary<K: KVStore + Sync + Send + 'static>(
1603
1603
}
1604
1604
1605
1605
async fn do_connect_peer < K : KVStore + Sync + Send + ' static > (
1606
- node_id : PublicKey , addr : NetAddress , peer_manager : Arc < PeerManager < K > > ,
1606
+ node_id : PublicKey , addr : SocketAddress , peer_manager : Arc < PeerManager < K > > ,
1607
1607
logger : Arc < FilesystemLogger > ,
1608
1608
) -> Result < ( ) , Error > {
1609
1609
log_info ! ( logger, "Connecting to peer: {}@{}" , node_id, addr) ;
@@ -1612,7 +1612,7 @@ async fn do_connect_peer<K: KVStore + Sync + Send + 'static>(
1612
1612
. to_socket_addrs ( )
1613
1613
. map_err ( |e| {
1614
1614
log_error ! ( logger, "Failed to resolve network address: {}" , e) ;
1615
- Error :: InvalidNetAddress
1615
+ Error :: InvalidSocketAddress
1616
1616
} ) ?
1617
1617
. next ( )
1618
1618
. ok_or ( Error :: ConnectionFailed ) ?;
0 commit comments