diff --git a/src/fiber/channel.rs b/src/fiber/channel.rs index 90499355..0f945b25 100644 --- a/src/fiber/channel.rs +++ b/src/fiber/channel.rs @@ -7,7 +7,7 @@ use crate::{ fiber::{ fee::calculate_tlc_forward_fee, network::{get_chain_hash, SendOnionPacketCommand}, - types::{ChannelUpdate, TlcErr, TlcErrPacket, TlcErrorCode}, + types::{BroadcastMessage, ChannelUpdate, TlcErr, TlcErrPacket, TlcErrorCode}, }, invoice::{CkbInvoice, CkbInvoiceStatus, InvoiceStore}, }; @@ -1478,10 +1478,9 @@ where self.network .send_message(NetworkActorMessage::new_command( - NetworkActorCommand::ProccessChannelUpdate( - self.get_remote_peer_id(), + NetworkActorCommand::BroadcastMessage(BroadcastMessage::ChannelUpdate( update, - ), + )), )) .expect(ASSUME_NETWORK_ACTOR_ALIVE); @@ -2621,10 +2620,9 @@ impl ChannelActorState { network .send_message(NetworkActorMessage::new_command( - NetworkActorCommand::ProccessChannelUpdate( - self.get_remote_peer_id(), + NetworkActorCommand::BroadcastMessage(BroadcastMessage::ChannelUpdate( channel_update, - ), + )), )) .expect(ASSUME_NETWORK_ACTOR_ALIVE); } @@ -4626,11 +4624,10 @@ impl ChannelActorState { ); network .send_message(NetworkActorMessage::new_command( - NetworkActorCommand::ProcessChannelAnnouncement( - self.get_remote_peer_id(), - self.get_funding_transaction_block_number(), - self.get_funding_transaction_index(), - channel_announcement, + NetworkActorCommand::BroadcastMessage( + crate::fiber::types::BroadcastMessage::ChannelAnnouncement( + channel_announcement, + ), ), )) .expect(ASSUME_NETWORK_ACTOR_ALIVE); @@ -4641,10 +4638,9 @@ impl ChannelActorState { network .send_message(NetworkActorMessage::new_command( - NetworkActorCommand::ProccessChannelUpdate( - self.get_remote_peer_id(), + NetworkActorCommand::BroadcastMessage(BroadcastMessage::ChannelUpdate( channel_update, - ), + )), )) .expect(ASSUME_NETWORK_ACTOR_ALIVE); } diff --git a/src/fiber/network.rs b/src/fiber/network.rs index 59ba38a3..083b0aff 100644 --- a/src/fiber/network.rs +++ b/src/fiber/network.rs @@ -211,17 +211,6 @@ pub enum NetworkActorCommand { ), UpdateChannelFunding(Hash256, Transaction, FundingRequest), SignTx(PeerId, Hash256, Transaction, Option>>), - // A ChannelAnnouncement is ready to broadcast, we need to - // update our network graph and broadcast it to the network. - // The channel counterparty should definitely be part of the - // nodes that are going to receive this message. - ProcessChannelAnnouncement(PeerId, BlockNumber, u32, ChannelAnnouncement), - // A ChannelUpdate is ready to broadcast, we need to update - // our network graph and broadcast it to the network. - // The channel counterparty should definitely be part of the - // nodes that are going to receive this message. - ProccessChannelUpdate(PeerId, ChannelUpdate), - // Broadcast node/channel information to the network. BroadcastMessage(BroadcastMessage), // Broadcast local information to the network. BroadcastLocalInfo(LocalInfoKind), @@ -1284,29 +1273,7 @@ where ); } }, - NetworkActorCommand::ProcessChannelAnnouncement( - peer_id, - block_number, - tx_index, - channel_announcement, - ) => { - debug!( - "Processing our channel announcement message (confirmed at #{} block #{} tx) to peer {:?}: {:?}", - &block_number, - &tx_index, - &peer_id, - &channel_announcement - ); - // TODO: Save the channel announcement to the database. - } - NetworkActorCommand::ProccessChannelUpdate(peer_id, channel_update) => { - debug!( - "Processing our channel update message to peer {:?}: {:?}", - &peer_id, &channel_update - ); - // TODO: Save the channel update to the database. - } NetworkActorCommand::NodeInfo(_, rpc) => { let response = NodeInfoResponse { node_name: state.node_name.clone(),