Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
23785ee
Send payment with payment actor
jjyr Dec 3, 2025
e20f59e
Create new payment actor if can't find one to resume
jjyr Dec 8, 2025
2e94985
Increase DEFAULT_WAIT_UNTIL_TIME to 10s since we use more actors in t…
jjyr Dec 8, 2025
1a0b353
Add metrics fiber.inflight_payments_count
jjyr Dec 8, 2025
baf5a51
Try fix random send_payment tests failure
jjyr Dec 8, 2025
2528b1b
update log level when payment actor stopped
jjyr Dec 8, 2025
72cae9a
improve build_payment_routes for large amount
chenyukang Dec 9, 2025
f462552
backup
chenyukang Dec 9, 2025
d51dc3c
add metric
chenyukang Dec 10, 2025
c3a992d
more perf tunning
chenyukang Dec 10, 2025
68b8001
add find_max_routable_amount_on_path
chenyukang Dec 10, 2025
6af074c
add find_max_routable_amount_on_path
chenyukang Dec 10, 2025
8ea3ec0
code cleanup
chenyukang Dec 10, 2025
219d2bd
fix wasm32 issue
chenyukang Dec 10, 2025
4e4b2bf
code cleanup
chenyukang Dec 10, 2025
dce807d
more on metric and code refactor
chenyukang Dec 11, 2025
b64a793
merge payment actor
chenyukang Dec 11, 2025
175a4cc
Avoid panick when send message to payment actor
jjyr Dec 11, 2025
34351f1
Apply review suggestions, remove unused arg
jjyr Dec 11, 2025
9a65671
Merge branch 'pr/jjyr/986' into perf-test-path-finding
chenyukang Dec 12, 2025
e3d58b9
update ractor remove actor_id in metrics
jjyr Dec 13, 2025
247e63b
update ractor
chenyukang Dec 15, 2025
e09f683
Merge branch 'jjyr/fix-start-peer-filter-actor-error' into perf-test-…
chenyukang Dec 15, 2025
b021dbb
merge log helper
chenyukang Dec 16, 2025
6eac87d
add more log for retryable tasks
chenyukang Dec 17, 2025
571f7a2
add more log for retryable tasks
chenyukang Dec 17, 2025
1dc60ce
Merge branch 'develop' into find-path-perf-2
chenyukang Dec 18, 2025
3b50b36
merge develop
chenyukang Dec 18, 2025
41b14ee
Merge branch 'develop' into perf-test-path-finding
chenyukang Dec 18, 2025
63bc595
Logging channel ack state
jjyr Dec 18, 2025
8322a75
Fix payment actor do not terminate when payment fail
jjyr Dec 18, 2025
d016cb7
Check inflight payment count in tests
jjyr Dec 18, 2025
d8d23d0
merge ractor refactor
chenyukang Dec 18, 2025
3e3418b
Merge branch 'quake/fix-expired-tlc-check' into perf-test-path-finding
chenyukang Dec 18, 2025
d500634
merge ack state monitoring
chenyukang Dec 25, 2025
0cd623d
Merge branch 'develop' into perf-test-path-finding
chenyukang Dec 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/fiber-lib/src/cch/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use tokio_util::{sync::CancellationToken, task::TaskTracker};

use crate::ckb::contracts::{get_script_by_contract, Contract};
use crate::fiber::hash_algorithm::HashAlgorithm;
use crate::fiber::network::SendPaymentCommand;
use crate::fiber::payment::PaymentStatus;
use crate::fiber::payment::SendPaymentCommand;
use crate::fiber::types::{Hash256, Privkey};
use crate::fiber::ASSUME_NETWORK_ACTOR_ALIVE;
use crate::fiber::{NetworkActorCommand, NetworkActorMessage};
Expand Down
81 changes: 64 additions & 17 deletions crates/fiber-lib/src/fiber/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::fiber::config::MILLI_SECONDS_PER_EPOCH;
use crate::fiber::fee::{check_open_channel_parameters, check_tlc_delta_with_epochs};
#[cfg(any(debug_assertions, feature = "bench"))]
use crate::fiber::network::DebugEvent;
use crate::fiber::network::PaymentCustomRecords;
use crate::fiber::payment::PaymentCustomRecords;
use crate::fiber::types::TxSignatures;
use crate::utils::actor::ActorHandleLogGuard;
use crate::{debug_event, fiber::types::TxAbort, utils::tx::compute_tx_message};
Expand Down Expand Up @@ -43,9 +43,8 @@ use crate::{
},
hash_algorithm::HashAlgorithm,
key::blake2b_hash_with_salt,
network::{
get_chain_hash, sign_network_message, FiberMessageWithPeerId, SendOnionPacketCommand,
},
network::SendOnionPacketCommand,
network::{get_chain_hash, sign_network_message, FiberMessageWithPeerId},
serde_utils::{CompactSignatureAsBytes, EntityHex, PubNonceAsBytes},
types::{
AcceptChannel, AddTlc, AnnouncementSignatures, BroadcastMessageWithTimestamp,
Expand Down Expand Up @@ -1750,18 +1749,23 @@ where
peeled_onion_packet: PeeledPaymentOnionPacket,
forward_fee: u128,
) {
let (send, _recv) = oneshot::channel::<Result<(), TlcErr>>();
let port = RpcReplyPort::from(send);
match self.network.send_message(NetworkActorMessage::Command(
NetworkActorCommand::SendPaymentOnionPacket(SendOnionPacketCommand {
peeled_onion_packet: peeled_onion_packet.clone(),
previous_tlc: Some(PrevTlcInfo::new(
state.get_id(),
u64::from(tlc_id),
forward_fee,
)),
payment_hash,
// forward tlc always set attempt_id to None
attempt_id: None,
}),
NetworkActorCommand::SendPaymentOnionPacket(
SendOnionPacketCommand {
peeled_onion_packet: peeled_onion_packet.clone(),
previous_tlc: Some(PrevTlcInfo::new(
state.get_id(),
u64::from(tlc_id),
forward_fee,
)),
payment_hash,
// forward tlc always set attempt_id to None
attempt_id: None,
},
port,
),
)) {
Ok(_) => {
// we successfully sent the forward tlc, we will wait for the result
Expand Down Expand Up @@ -1826,12 +1830,25 @@ where
state: &mut ChannelActorState,
trigger_next: bool,
) {
debug!(
"apply_retryable_tlc_operations start: remained_ops={} waiting_tlc_ack={} reestablishing={}",
state.retryable_tlc_operations.len(),
state.is_waiting_tlc_ack(),
state.reestablishing
);
state.log_ack_state("[ack] retryable_ops_start");
loop {
if state.is_waiting_tlc_ack() {
state.log_ack_state("[ack] retryable_ops_blocked");
debug!(
"apply_retryable_tlc_operations blocked remained_ops={}",
state.retryable_tlc_operations.len()
);
break;
}

let Some(operation) = state.retryable_tlc_operations.pop_front() else {
debug!("apply_retryable_tlc_operations empty queue, exiting",);
return;
};

Expand Down Expand Up @@ -1873,6 +1890,12 @@ where
if trigger_next {
state.schedule_next_retry_task(myself);
}
debug!(
"apply_retryable_tlc_operations finished: remained_ops={} trigger_next={} waiting_tlc_ack={}",
state.retryable_tlc_operations.len(),
trigger_next,
state.is_waiting_tlc_ack()
);
}

fn handle_forward_tlc_result(
Expand Down Expand Up @@ -4176,6 +4199,11 @@ impl ChannelActorState {

pub fn set_waiting_ack(&mut self, myself: &ActorRef<ChannelActorMessage>, waiting_ack: bool) {
self.tlc_state.set_waiting_ack(waiting_ack);
self.log_ack_state(if waiting_ack {
"[ack] set_waiting_ack(true)"
} else {
"[ack] set_waiting_ack(false)"
});
if waiting_ack {
self.set_waiting_peer_response();
myself.send_after(Duration::from_millis(PEER_CHANNEL_RESPONSE_TIMEOUT), || {
Expand All @@ -4186,6 +4214,18 @@ impl ChannelActorState {
}
}

fn log_ack_state(&self, context: &str) {
debug!(
channel = ?self.get_id(),
"{} waiting_ack={} send_present={} verify_present={} next_present={}",
context,
self.tlc_state.waiting_ack,
self.remote_revocation_nonce_for_send.is_some(),
self.remote_revocation_nonce_for_verify.is_some(),
self.remote_revocation_nonce_for_next.is_some()
);
}

pub fn try_create_channel_messages(&mut self) -> Option<(ChannelAnnouncement, ChannelUpdate)> {
let channel_announcement = self.try_create_channel_announcement_message()?;
let channel_update = self.try_create_channel_update_message()?;
Expand Down Expand Up @@ -4597,6 +4637,7 @@ impl ChannelActorState {
if let Some(nonce) = remote_channel_announcement_nonce {
state.update_remote_channel_announcement_nonce(&nonce);
}
state.log_ack_state("[ack] new_inbound_channel");
state
}

Expand All @@ -4622,7 +4663,7 @@ impl ChannelActorState {
let signer = InMemorySigner::generate_from_seed(seed);
let local_pubkeys = signer.get_base_public_keys();
let temp_channel_id = derive_temp_channel_id_from_tlc_key(&local_pubkeys.tlc_base_key);
Self {
let state = Self {
state: ChannelState::NegotiatingFunding(NegotiatingFundingFlags::empty()),
public_channel_info,
local_tlc_info,
Expand Down Expand Up @@ -4674,7 +4715,9 @@ impl ChannelActorState {
pending_notify_settle_tlcs: vec![],
ephemeral_config: Default::default(),
private_key: Some(private_key),
}
};
state.log_ack_state("[ack] new_outbound_channel");
state
}

fn check_accept_channel_parameters(&self) -> ProcessingChannelResult {
Expand Down Expand Up @@ -4961,6 +5004,7 @@ impl ChannelActorState {
)),
))
.expect(ASSUME_NETWORK_ACTOR_ALIVE);
self.log_ack_state("[ack] send_revoke_and_ack_message(resend_cached)");
return Ok(());
}
None => {
Expand Down Expand Up @@ -5048,6 +5092,7 @@ impl ChannelActorState {
} else {
self.remote_revocation_nonce_for_send = None;
}
self.log_ack_state("[ack] send_revoke_and_ack_message");

self.network()
.send_message(NetworkActorMessage::new_command(
Expand Down Expand Up @@ -6018,6 +6063,7 @@ impl ChannelActorState {
self.remote_revocation_nonce_for_send = Some(accept_channel.next_revocation_nonce.clone());
self.remote_revocation_nonce_for_verify =
Some(accept_channel.next_revocation_nonce.clone());
self.log_ack_state("[ack] handle_accept_channel_message");
let remote_pubkeys = (&accept_channel).into();
self.remote_channel_public_keys = Some(remote_pubkeys);
self.remote_commitment_points = vec![
Expand Down Expand Up @@ -6677,6 +6723,7 @@ impl ChannelActorState {
} else {
self.remote_revocation_nonce_for_verify = None;
}
self.log_ack_state("[ack] handle_revoke_and_ack_peer_message");

self.network()
.send_message(NetworkActorMessage::new_notification(
Expand Down
Loading
Loading