Skip to content

Commit 9f4330e

Browse files
committed
make message fields public, part 1
1 parent 22a0dd5 commit 9f4330e

File tree

1 file changed

+83
-39
lines changed

1 file changed

+83
-39
lines changed

lightning/src/ln/msgs.rs

+83-39
Original file line numberDiff line numberDiff line change
@@ -74,63 +74,107 @@ pub struct Init {
7474
/// An error message to be sent or received from a peer
7575
#[derive(Clone)]
7676
pub struct ErrorMessage {
77-
pub(crate) channel_id: [u8; 32],
78-
pub(crate) data: String,
77+
/// The channel ID involved in the error
78+
pub channel_id: [u8; 32],
79+
/// A possibly human-readable error description.
80+
/// The string should be sanitized before it is used (e.g. emitted to logs
81+
/// or printed to stdout). Otherwise, a well crafted error message may trigger a security
82+
/// vulnerability in the terminal emulator or the logging subsystem.
83+
pub data: String,
7984
}
8085

8186
/// A ping message to be sent or received from a peer
8287
pub struct Ping {
83-
pub(crate) ponglen: u16,
84-
pub(crate) byteslen: u16,
88+
/// The desired response length
89+
pub ponglen: u16,
90+
/// The ping packet size.
91+
/// This field is not sent on the wire. byteslen zeros are sent.
92+
pub byteslen: u16,
8593
}
8694

8795
/// A pong message to be sent or received from a peer
8896
pub struct Pong {
89-
pub(crate) byteslen: u16,
97+
/// The pong packet size.
98+
/// This field is not sent on the wire. byteslen zeros are sent.
99+
pub byteslen: u16,
90100
}
91101

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

116145
/// An accept_channel message to be sent or received from a peer
117146
#[derive(Clone)]
118147
pub struct AcceptChannel {
119-
pub(crate) temporary_channel_id: [u8; 32],
120-
pub(crate) dust_limit_satoshis: u64,
121-
pub(crate) max_htlc_value_in_flight_msat: u64,
122-
pub(crate) channel_reserve_satoshis: u64,
123-
pub(crate) htlc_minimum_msat: u64,
124-
pub(crate) minimum_depth: u32,
125-
pub(crate) to_self_delay: u16,
126-
pub(crate) max_accepted_htlcs: u16,
127-
pub(crate) funding_pubkey: PublicKey,
128-
pub(crate) revocation_basepoint: PublicKey,
129-
pub(crate) payment_point: PublicKey,
130-
pub(crate) delayed_payment_basepoint: PublicKey,
131-
pub(crate) htlc_basepoint: PublicKey,
132-
pub(crate) first_per_commitment_point: PublicKey,
133-
pub(crate) shutdown_scriptpubkey: OptionalField<Script>
148+
/// A temporary channel ID, until the funding is established
149+
pub temporary_channel_id: [u8; 32],
150+
/// The threshold below which outputs should be omitted
151+
pub dust_limit_satoshis: u64,
152+
/// The maximum total HTLC value in flight, in milli-satoshi
153+
pub max_htlc_value_in_flight_msat: u64,
154+
/// The minimum value for the counterparty to keep in the channel
155+
pub channel_reserve_satoshis: u64,
156+
/// The minimum HTLC size, in milli-satoshi
157+
pub htlc_minimum_msat: u64,
158+
/// Minimum depth of the funding transaction before the channel is considered open
159+
pub minimum_depth: u32,
160+
/// The minimum to_self_delay for the counterparty's transactions
161+
pub to_self_delay: u16,
162+
/// The maximum number of accepted HTLCs
163+
pub max_accepted_htlcs: u16,
164+
/// The funding public key
165+
pub funding_pubkey: PublicKey,
166+
/// The funding public key
167+
pub revocation_basepoint: PublicKey,
168+
/// The payment point
169+
pub payment_point: PublicKey,
170+
/// The delayed payment basepoint
171+
pub delayed_payment_basepoint: PublicKey,
172+
/// The HTLC basepoint
173+
pub htlc_basepoint: PublicKey,
174+
/// The first transaction's per commitment point
175+
pub first_per_commitment_point: PublicKey,
176+
/// Optionally, the scriptPubkey when we collaboratively close
177+
pub shutdown_scriptpubkey: OptionalField<Script>,
134178
}
135179

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

0 commit comments

Comments
 (0)