Skip to content

Commit 07ef52f

Browse files
committed
Reorder struct definitions so that they are in dependency order.
There are a few cases where the upcoming C bindings don't know how to handle something which depends on something defined later in the file. Instead of adding another pass to the C bindings generator, it is much simpler to just reorder structs.
1 parent 7de6cb8 commit 07ef52f

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

lightning/src/routing/network_graph.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ use std::collections::btree_map::Entry as BtreeEntry;
3333
use std::ops::Deref;
3434
use bitcoin::hashes::hex::ToHex;
3535

36+
/// Represents the network as nodes and channels between them
37+
#[derive(PartialEq)]
38+
pub struct NetworkGraph {
39+
channels: BTreeMap<u64, ChannelInfo>,
40+
nodes: BTreeMap<PublicKey, NodeInfo>,
41+
}
42+
3643
/// Receives and validates network updates from peers,
3744
/// stores authentic and relevant data as a network graph.
3845
/// This network graph is then used for routing payments.
@@ -443,13 +450,6 @@ impl Readable for NodeInfo {
443450
}
444451
}
445452

446-
/// Represents the network as nodes and channels between them
447-
#[derive(PartialEq)]
448-
pub struct NetworkGraph {
449-
channels: BTreeMap<u64, ChannelInfo>,
450-
nodes: BTreeMap<PublicKey, NodeInfo>,
451-
}
452-
453453
impl Writeable for NetworkGraph {
454454
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), ::std::io::Error> {
455455
(self.channels.len() as u64).write(writer)?;

lightning/src/util/config.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,6 @@
1212
1313
use ln::channelmanager::{BREAKDOWN_TIMEOUT, MAX_LOCAL_BREAKDOWN_TIMEOUT};
1414

15-
/// Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
16-
///
17-
/// Default::default() provides sane defaults for most configurations
18-
/// (but currently with 0 relay fees!)
19-
#[derive(Clone, Debug)]
20-
pub struct UserConfig {
21-
/// Channel config that we propose to our counterparty.
22-
pub own_channel_config: ChannelHandshakeConfig,
23-
/// Limits applied to our counterparty's proposed channel config settings.
24-
pub peer_channel_config_limits: ChannelHandshakeLimits,
25-
/// Channel config which affects behavior during channel lifetime.
26-
pub channel_options: ChannelConfig,
27-
}
28-
29-
impl Default for UserConfig {
30-
fn default() -> Self {
31-
UserConfig {
32-
own_channel_config: ChannelHandshakeConfig::default(),
33-
peer_channel_config_limits: ChannelHandshakeLimits::default(),
34-
channel_options: ChannelConfig::default(),
35-
}
36-
}
37-
}
38-
3915
/// Configuration we set when applicable.
4016
///
4117
/// Default::default() provides sane defaults.
@@ -228,3 +204,27 @@ impl_writeable!(ChannelConfig, 8+1+1, {
228204
announced_channel,
229205
commit_upfront_shutdown_pubkey
230206
});
207+
208+
/// Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
209+
///
210+
/// Default::default() provides sane defaults for most configurations
211+
/// (but currently with 0 relay fees!)
212+
#[derive(Clone, Debug)]
213+
pub struct UserConfig {
214+
/// Channel config that we propose to our counterparty.
215+
pub own_channel_config: ChannelHandshakeConfig,
216+
/// Limits applied to our counterparty's proposed channel config settings.
217+
pub peer_channel_config_limits: ChannelHandshakeLimits,
218+
/// Channel config which affects behavior during channel lifetime.
219+
pub channel_options: ChannelConfig,
220+
}
221+
222+
impl Default for UserConfig {
223+
fn default() -> Self {
224+
UserConfig {
225+
own_channel_config: ChannelHandshakeConfig::default(),
226+
peer_channel_config_limits: ChannelHandshakeLimits::default(),
227+
channel_options: ChannelConfig::default(),
228+
}
229+
}
230+
}

0 commit comments

Comments
 (0)