Skip to content

Commit 8a1cba4

Browse files
committed
make message fields public, part 1
1 parent 99eef23 commit 8a1cba4

File tree

1 file changed

+80
-39
lines changed

1 file changed

+80
-39
lines changed

lightning/src/ln/msgs.rs

+80-39
Original file line numberDiff line numberDiff line change
@@ -65,63 +65,104 @@ pub struct Init {
6565
/// An error message to be sent or received from a peer
6666
#[derive(Clone)]
6767
pub struct ErrorMessage {
68-
pub(crate) channel_id: [u8; 32],
69-
pub(crate) data: String,
68+
/// The channel ID involved in the error
69+
pub channel_id: [u8; 32],
70+
/// Human readable error description
71+
pub data: String,
7072
}
7173

7274
/// A ping message to be sent or received from a peer
7375
pub struct Ping {
74-
pub(crate) ponglen: u16,
75-
pub(crate) byteslen: u16,
76+
/// The desired response length
77+
pub ponglen: u16,
78+
/// The ping packet size.
79+
/// This field is not sent on the wire. byteslen zeros are sent.
80+
pub byteslen: u16,
7681
}
7782

7883
/// A pong message to be sent or received from a peer
7984
pub struct Pong {
80-
pub(crate) byteslen: u16,
85+
/// The pong packet size.
86+
/// This field is not sent on the wire. byteslen zeros are sent.
87+
pub byteslen: u16,
8188
}
8289

8390
/// An open_channel message to be sent or received from a peer
8491
#[derive(Clone)]
8592
pub struct OpenChannel {
86-
pub(crate) chain_hash: BlockHash,
87-
pub(crate) temporary_channel_id: [u8; 32],
88-
pub(crate) funding_satoshis: u64,
89-
pub(crate) push_msat: u64,
90-
pub(crate) dust_limit_satoshis: u64,
91-
pub(crate) max_htlc_value_in_flight_msat: u64,
92-
pub(crate) channel_reserve_satoshis: u64,
93-
pub(crate) htlc_minimum_msat: u64,
94-
pub(crate) feerate_per_kw: u32,
95-
pub(crate) to_self_delay: u16,
96-
pub(crate) max_accepted_htlcs: u16,
97-
pub(crate) funding_pubkey: PublicKey,
98-
pub(crate) revocation_basepoint: PublicKey,
99-
pub(crate) payment_point: PublicKey,
100-
pub(crate) delayed_payment_basepoint: PublicKey,
101-
pub(crate) htlc_basepoint: PublicKey,
102-
pub(crate) first_per_commitment_point: PublicKey,
103-
pub(crate) channel_flags: u8,
104-
pub(crate) shutdown_scriptpubkey: OptionalField<Script>,
93+
/// The genesis hash of the blockchain where the channel is to be opened
94+
pub chain_hash: BlockHash,
95+
/// A temporary channel ID, until the funding is established
96+
pub temporary_channel_id: [u8; 32],
97+
/// The channel value
98+
pub funding_satoshis: u64,
99+
/// The amount to push to the counterparty as part of the open, in milli-satoshi
100+
pub push_msat: u64,
101+
/// The threshold below which outputs should be omitted
102+
pub dust_limit_satoshis: u64,
103+
/// The maximum total HTLC value in flight, in milli-satoshi
104+
pub max_htlc_value_in_flight_msat: u64,
105+
/// The minimum value for the counterparty to keep in the channel
106+
pub channel_reserve_satoshis: u64,
107+
/// The minimum HTLC size, in milli-satoshi
108+
pub htlc_minimum_msat: u64,
109+
/// The feerate per 1000-weight of the transaction
110+
pub feerate_per_kw: u32,
111+
/// The minimum to_self_delay for the counterparty's transactions
112+
pub to_self_delay: u16,
113+
/// The maximum number of accepted HTLCs
114+
pub max_accepted_htlcs: u16,
115+
/// The funding public key
116+
pub funding_pubkey: PublicKey,
117+
/// The funding public key
118+
pub revocation_basepoint: PublicKey,
119+
/// The payment point
120+
pub payment_point: PublicKey,
121+
/// The delayed payment basepoint
122+
pub delayed_payment_basepoint: PublicKey,
123+
/// The HTLC basepoint
124+
pub htlc_basepoint: PublicKey,
125+
/// The first transaction's per commitment point
126+
pub first_per_commitment_point: PublicKey,
127+
/// Channel flags
128+
pub channel_flags: u8,
129+
/// Optionally, the scriptPubkey when we collaboratively close
130+
pub shutdown_scriptpubkey: OptionalField<Script>,
105131
}
106132

107133
/// An accept_channel message to be sent or received from a peer
108134
#[derive(Clone)]
109135
pub struct AcceptChannel {
110-
pub(crate) temporary_channel_id: [u8; 32],
111-
pub(crate) dust_limit_satoshis: u64,
112-
pub(crate) max_htlc_value_in_flight_msat: u64,
113-
pub(crate) channel_reserve_satoshis: u64,
114-
pub(crate) htlc_minimum_msat: u64,
115-
pub(crate) minimum_depth: u32,
116-
pub(crate) to_self_delay: u16,
117-
pub(crate) max_accepted_htlcs: u16,
118-
pub(crate) funding_pubkey: PublicKey,
119-
pub(crate) revocation_basepoint: PublicKey,
120-
pub(crate) payment_point: PublicKey,
121-
pub(crate) delayed_payment_basepoint: PublicKey,
122-
pub(crate) htlc_basepoint: PublicKey,
123-
pub(crate) first_per_commitment_point: PublicKey,
124-
pub(crate) shutdown_scriptpubkey: OptionalField<Script>
136+
/// A temporary channel ID, until the funding is established
137+
pub temporary_channel_id: [u8; 32],
138+
/// The threshold below which outputs should be omitted
139+
pub dust_limit_satoshis: u64,
140+
/// The maximum total HTLC value in flight, in milli-satoshi
141+
pub max_htlc_value_in_flight_msat: u64,
142+
/// The minimum value for the counterparty to keep in the channel
143+
pub channel_reserve_satoshis: u64,
144+
/// The minimum HTLC size, in milli-satoshi
145+
pub htlc_minimum_msat: u64,
146+
/// Minimum depth of the funding transaction before the channel is considered open
147+
pub minimum_depth: u32,
148+
/// The minimum to_self_delay for the counterparty's transactions
149+
pub to_self_delay: u16,
150+
/// The maximum number of accepted HTLCs
151+
pub max_accepted_htlcs: u16,
152+
/// The funding public key
153+
pub funding_pubkey: PublicKey,
154+
/// The funding public key
155+
pub revocation_basepoint: PublicKey,
156+
/// The payment point
157+
pub payment_point: PublicKey,
158+
/// The delayed payment basepoint
159+
pub delayed_payment_basepoint: PublicKey,
160+
/// The HTLC basepoint
161+
pub htlc_basepoint: PublicKey,
162+
/// The first transaction's per commitment point
163+
pub first_per_commitment_point: PublicKey,
164+
/// Optionally, the scriptPubkey when we collaboratively close
165+
pub shutdown_scriptpubkey: OptionalField<Script>,
125166
}
126167

127168
/// A funding_created message to be sent or received from a peer

0 commit comments

Comments
 (0)