mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-24 23:08:36 +01:00
Remove redundant 'outbound' wording from methods
This commit is contained in:
parent
bd297fe39d
commit
b4d082b833
4 changed files with 14 additions and 14 deletions
|
@ -1120,7 +1120,7 @@ impl<ChannelSigner: WriteableEcdsaChannelSigner> OnchainTxHandler<ChannelSigner>
|
|||
}
|
||||
|
||||
//TODO: getting lastest holder transactions should be infallible and result in us "force-closing the channel", but we may
|
||||
// have empty holder commitment transaction if a ChannelMonitor is asked to force-close just after Channel::get_outbound_funding_created,
|
||||
// have empty holder commitment transaction if a ChannelMonitor is asked to force-close just after OutboundV1Channel::get_funding_created,
|
||||
// before providing a initial commitment transaction. For outbound channel, init ChannelMonitor at Channel::funding_signed, there is nothing
|
||||
// to monitor before.
|
||||
pub(crate) fn get_fully_signed_holder_tx(&mut self, funding_redeemscript: &Script) -> Transaction {
|
||||
|
|
|
@ -995,7 +995,7 @@ impl<Signer: ChannelSigner> ChannelContext<Signer> {
|
|||
}
|
||||
|
||||
/// Returns the funding_txo we either got from our peer, or were given by
|
||||
/// get_outbound_funding_created.
|
||||
/// get_funding_created.
|
||||
pub fn get_funding_txo(&self) -> Option<OutPoint> {
|
||||
self.channel_transaction_parameters.funding_outpoint
|
||||
}
|
||||
|
@ -1440,7 +1440,7 @@ impl<Signer: ChannelSigner> ChannelContext<Signer> {
|
|||
#[inline]
|
||||
/// Creates a set of keys for build_commitment_transaction to generate a transaction which we
|
||||
/// will sign and send to our counterparty.
|
||||
/// If an Err is returned, it is a ChannelError::Close (for get_outbound_funding_created)
|
||||
/// If an Err is returned, it is a ChannelError::Close (for get_funding_created)
|
||||
fn build_remote_transaction_keys(&self) -> TxCreationKeys {
|
||||
//TODO: Ensure that the payment_key derived here ends up in the library users' wallet as we
|
||||
//may see payments to it!
|
||||
|
@ -2026,7 +2026,7 @@ fn commit_tx_fee_msat(feerate_per_kw: u32, num_htlcs: usize, channel_type_featur
|
|||
|
||||
// TODO: We should refactor this to be an Inbound/OutboundChannel until initial setup handshaking
|
||||
// has been completed, and then turn into a Channel to get compiler-time enforcement of things like
|
||||
// calling channel_id() before we're set up or things like get_outbound_funding_signed on an
|
||||
// calling channel_id() before we're set up or things like get_funding_signed on an
|
||||
// inbound channel.
|
||||
//
|
||||
// Holder designates channel data owned for the benefit of the user client.
|
||||
|
@ -5682,8 +5682,8 @@ impl<Signer: WriteableEcdsaChannelSigner> OutboundV1Channel<Signer> {
|
|||
})
|
||||
}
|
||||
|
||||
/// If an Err is returned, it is a ChannelError::Close (for get_outbound_funding_created)
|
||||
fn get_outbound_funding_created_signature<L: Deref>(&mut self, logger: &L) -> Result<Signature, ChannelError> where L::Target: Logger {
|
||||
/// If an Err is returned, it is a ChannelError::Close (for get_funding_created)
|
||||
fn get_funding_created_signature<L: Deref>(&mut self, logger: &L) -> Result<Signature, ChannelError> where L::Target: Logger {
|
||||
let counterparty_keys = self.context.build_remote_transaction_keys();
|
||||
let counterparty_initial_commitment_tx = self.context.build_commitment_transaction(self.context.cur_counterparty_commitment_transaction_number, &counterparty_keys, false, false, logger).tx;
|
||||
Ok(self.context.holder_signer.sign_counterparty_commitment(&counterparty_initial_commitment_tx, Vec::new(), &self.context.secp_ctx)
|
||||
|
@ -5697,7 +5697,7 @@ impl<Signer: WriteableEcdsaChannelSigner> OutboundV1Channel<Signer> {
|
|||
/// Note that channel_id changes during this call!
|
||||
/// Do NOT broadcast the funding transaction until after a successful funding_signed call!
|
||||
/// If an Err is returned, it is a ChannelError::Close.
|
||||
pub fn get_outbound_funding_created<L: Deref>(mut self, funding_transaction: Transaction, funding_txo: OutPoint, logger: &L)
|
||||
pub fn get_funding_created<L: Deref>(mut self, funding_transaction: Transaction, funding_txo: OutPoint, logger: &L)
|
||||
-> Result<(Channel<Signer>, msgs::FundingCreated), (Self, ChannelError)> where L::Target: Logger {
|
||||
if !self.context.is_outbound() {
|
||||
panic!("Tried to create outbound funding_created message on an inbound channel!");
|
||||
|
@ -5714,7 +5714,7 @@ impl<Signer: WriteableEcdsaChannelSigner> OutboundV1Channel<Signer> {
|
|||
self.context.channel_transaction_parameters.funding_outpoint = Some(funding_txo);
|
||||
self.context.holder_signer.provide_channel_parameters(&self.context.channel_transaction_parameters);
|
||||
|
||||
let signature = match self.get_outbound_funding_created_signature(logger) {
|
||||
let signature = match self.get_funding_created_signature(logger) {
|
||||
Ok(res) => res,
|
||||
Err(e) => {
|
||||
log_error!(logger, "Got bad signatures: {:?}!", e);
|
||||
|
@ -7598,7 +7598,7 @@ mod tests {
|
|||
value: 10000000, script_pubkey: output_script.clone(),
|
||||
}]};
|
||||
let funding_outpoint = OutPoint{ txid: tx.txid(), index: 0 };
|
||||
let (mut node_a_chan, funding_created_msg) = node_a_chan.get_outbound_funding_created(tx.clone(), funding_outpoint, &&logger).map_err(|_| ()).unwrap();
|
||||
let (mut node_a_chan, funding_created_msg) = node_a_chan.get_funding_created(tx.clone(), funding_outpoint, &&logger).map_err(|_| ()).unwrap();
|
||||
let (_, funding_signed_msg, _) = node_b_chan.funding_created(&funding_created_msg, best_block, &&keys_provider, &&logger).map_err(|_| ()).unwrap();
|
||||
|
||||
// Node B --> Node A: funding signed
|
||||
|
@ -7725,7 +7725,7 @@ mod tests {
|
|||
value: 10000000, script_pubkey: output_script.clone(),
|
||||
}]};
|
||||
let funding_outpoint = OutPoint{ txid: tx.txid(), index: 0 };
|
||||
let (mut node_a_chan, funding_created_msg) = node_a_chan.get_outbound_funding_created(tx.clone(), funding_outpoint, &&logger).map_err(|_| ()).unwrap();
|
||||
let (mut node_a_chan, funding_created_msg) = node_a_chan.get_funding_created(tx.clone(), funding_outpoint, &&logger).map_err(|_| ()).unwrap();
|
||||
let (mut node_b_chan, funding_signed_msg, _) = node_b_chan.funding_created(&funding_created_msg, best_block, &&keys_provider, &&logger).map_err(|_| ()).unwrap();
|
||||
|
||||
// Node B --> Node A: funding signed
|
||||
|
@ -7913,7 +7913,7 @@ mod tests {
|
|||
value: 10000000, script_pubkey: output_script.clone(),
|
||||
}]};
|
||||
let funding_outpoint = OutPoint{ txid: tx.txid(), index: 0 };
|
||||
let (mut node_a_chan, funding_created_msg) = node_a_chan.get_outbound_funding_created(tx.clone(), funding_outpoint, &&logger).map_err(|_| ()).unwrap();
|
||||
let (mut node_a_chan, funding_created_msg) = node_a_chan.get_funding_created(tx.clone(), funding_outpoint, &&logger).map_err(|_| ()).unwrap();
|
||||
let (_, funding_signed_msg, _) = node_b_chan.funding_created(&funding_created_msg, best_block, &&keys_provider, &&logger).map_err(|_| ()).unwrap();
|
||||
|
||||
// Node B --> Node A: funding signed
|
||||
|
|
|
@ -3365,7 +3365,7 @@ where
|
|||
Some(chan) => {
|
||||
let funding_txo = find_funding_output(&chan, &funding_transaction)?;
|
||||
|
||||
let funding_res = chan.get_outbound_funding_created(funding_transaction, funding_txo, &self.logger)
|
||||
let funding_res = chan.get_funding_created(funding_transaction, funding_txo, &self.logger)
|
||||
.map_err(|(mut chan, e)| if let ChannelError::Close(msg) = e {
|
||||
let channel_id = chan.context.channel_id();
|
||||
let user_id = chan.context.get_user_id();
|
||||
|
|
|
@ -8881,13 +8881,13 @@ fn test_duplicate_chan_id() {
|
|||
let (_, funding_created) = {
|
||||
let per_peer_state = nodes[0].node.per_peer_state.read().unwrap();
|
||||
let mut a_peer_state = per_peer_state.get(&nodes[1].node.get_our_node_id()).unwrap().lock().unwrap();
|
||||
// Once we call `get_outbound_funding_created` the channel has a duplicate channel_id as
|
||||
// Once we call `get_funding_created` the channel has a duplicate channel_id as
|
||||
// another channel in the ChannelManager - an invalid state. Thus, we'd panic later when we
|
||||
// try to create another channel. Instead, we drop the channel entirely here (leaving the
|
||||
// channelmanager in a possibly nonsense state instead).
|
||||
let mut as_chan = a_peer_state.outbound_v1_channel_by_id.remove(&open_chan_2_msg.temporary_channel_id).unwrap();
|
||||
let logger = test_utils::TestLogger::new();
|
||||
as_chan.get_outbound_funding_created(tx.clone(), funding_outpoint, &&logger).map_err(|_| ()).unwrap()
|
||||
as_chan.get_funding_created(tx.clone(), funding_outpoint, &&logger).map_err(|_| ()).unwrap()
|
||||
};
|
||||
check_added_monitors!(nodes[0], 0);
|
||||
nodes[1].node.handle_funding_created(&nodes[0].node.get_our_node_id(), &funding_created);
|
||||
|
|
Loading…
Add table
Reference in a new issue