Skip to content

Commit 2736fae

Browse files
committed
Remove debug logs
1 parent 52c20fd commit 2736fae

1 file changed

Lines changed: 17 additions & 73 deletions

File tree

lightning/src/rgb_utils/mod.rs

Lines changed: 17 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -726,11 +726,9 @@ pub(crate) fn rename_rgb_files(
726726
) {
727727
let temp_chan_id = temporary_channel_id.0.as_hex().to_string();
728728
let chan_id = channel_id.0.as_hex().to_string();
729-
eprintln!("DEBUG rename_rgb_files: temp_chan_id={} -> chan_id={}", temp_chan_id, chan_id);
730729

731730
// Skip if the channel IDs are the same (nothing to rename)
732731
if temp_chan_id == chan_id {
733-
eprintln!("DEBUG rename_rgb_files: temp_chan_id == chan_id, skipping");
734732
return;
735733
}
736734

@@ -754,43 +752,21 @@ pub(crate) fn rename_rgb_files(
754752

755753
// Also copy in KVStore
756754
if let Some(kv_store) = get_rgb_kv_store(ldk_data_dir) {
757-
eprintln!("DEBUG rename_rgb_files: KVStore found, copying channel info");
758755
// Copy non-pending channel info
759-
match read_rgb_channel_info_kv(kv_store.as_ref(), &temp_chan_id, false) {
760-
Ok(rgb_info) => {
761-
eprintln!(
762-
"DEBUG rename_rgb_files: found non-pending temp channel info, copying to final"
763-
);
764-
let _ = write_rgb_channel_info_kv(kv_store.as_ref(), &chan_id, &rgb_info, false);
765-
let _ = kv_store.remove(RGB_PRIMARY_NS, RGB_CHANNEL_INFO_NS, &temp_chan_id, false);
766-
},
767-
Err(e) => {
768-
eprintln!(
769-
"DEBUG rename_rgb_files: non-pending temp channel info NOT found: {:?}",
770-
e
771-
);
772-
},
756+
if let Ok(rgb_info) = read_rgb_channel_info_kv(kv_store.as_ref(), &temp_chan_id, false) {
757+
let _ = write_rgb_channel_info_kv(kv_store.as_ref(), &chan_id, &rgb_info, false);
758+
let _ = kv_store.remove(RGB_PRIMARY_NS, RGB_CHANNEL_INFO_NS, &temp_chan_id, false);
773759
}
774760
// Copy pending channel info
775-
match read_rgb_channel_info_kv(kv_store.as_ref(), &temp_chan_id, true) {
776-
Ok(rgb_info) => {
777-
eprintln!(
778-
"DEBUG rename_rgb_files: found pending temp channel info, copying to final"
779-
);
780-
let _ = write_rgb_channel_info_kv(kv_store.as_ref(), &chan_id, &rgb_info, true);
781-
let _ = kv_store.remove(
782-
RGB_PRIMARY_NS,
783-
RGB_CHANNEL_INFO_PENDING_NS,
784-
&temp_chan_id,
785-
false,
786-
);
787-
},
788-
Err(e) => {
789-
eprintln!("DEBUG rename_rgb_files: pending temp channel info NOT found: {:?}", e);
790-
},
761+
if let Ok(rgb_info) = read_rgb_channel_info_kv(kv_store.as_ref(), &temp_chan_id, true) {
762+
let _ = write_rgb_channel_info_kv(kv_store.as_ref(), &chan_id, &rgb_info, true);
763+
let _ = kv_store.remove(
764+
RGB_PRIMARY_NS,
765+
RGB_CHANNEL_INFO_PENDING_NS,
766+
&temp_chan_id,
767+
false,
768+
);
791769
}
792-
} else {
793-
eprintln!("DEBUG rename_rgb_files: KVStore NOT found!");
794770
}
795771

796772
let funding_consignment_tmp = ldk_data_dir.join(format!("consignment_{}", temp_chan_id));
@@ -870,31 +846,21 @@ pub(crate) fn handle_funding(
870846
remote_rgb_amount,
871847
};
872848
let temporary_channel_id_str = temporary_channel_id.0.as_hex().to_string();
873-
eprintln!(
874-
"DEBUG handle_funding: writing channel info for temp_channel_id={}",
875-
temporary_channel_id_str
876-
);
877849
// Write to KVStore if available, otherwise fallback to filesystem
878850
if let Some(kv_store) = get_rgb_kv_store(ldk_data_dir) {
879-
eprintln!("DEBUG handle_funding: KVStore found, writing channel info");
880-
let res1 = write_rgb_channel_info_kv(
851+
let _ = write_rgb_channel_info_kv(
881852
kv_store.as_ref(),
882853
&temporary_channel_id_str,
883854
&rgb_info,
884855
true,
885856
);
886-
let res2 = write_rgb_channel_info_kv(
857+
let _ = write_rgb_channel_info_kv(
887858
kv_store.as_ref(),
888859
&temporary_channel_id_str,
889860
&rgb_info,
890861
false,
891862
);
892-
eprintln!(
893-
"DEBUG handle_funding: write results: pending={:?}, non-pending={:?}",
894-
res1, res2
895-
);
896863
} else {
897-
eprintln!("DEBUG handle_funding: KVStore NOT found, falling back to filesystem");
898864
write_rgb_channel_info(
899865
&get_rgb_channel_info_path(&temporary_channel_id_str, ldk_data_dir, true),
900866
&rgb_info,
@@ -950,53 +916,31 @@ pub(crate) fn update_rgb_channel_amount_pending(
950916
pub(crate) fn is_payment_rgb(ldk_data_dir: &Path, payment_hash: &PaymentHash) -> bool {
951917
let kv_store = match get_rgb_kv_store(ldk_data_dir) {
952918
Some(store) => store,
953-
None => {
954-
eprintln!("DEBUG is_payment_rgb: KVStore not found");
955-
return false;
956-
}
919+
None => return false,
957920
};
958921
let outbound = read_rgb_payment_info_kv(kv_store.as_ref(), payment_hash, false).is_ok();
959922
let inbound = read_rgb_payment_info_kv(kv_store.as_ref(), payment_hash, true).is_ok();
960-
let result = outbound || inbound;
961-
eprintln!("DEBUG is_payment_rgb: payment_hash={}, outbound={}, inbound={}, result={}",
962-
payment_hash.0.as_hex(), outbound, inbound, result);
963-
result
923+
outbound || inbound
964924
}
965925

966926
/// Detect the contract ID of the payment and filter first hops based on contract ID and amount
967927
pub(crate) fn filter_first_hops(
968928
ldk_data_dir: &Path, payment_hash: &PaymentHash, first_hops: &mut Vec<ChannelDetails>,
969929
) -> (ContractId, u64) {
970-
eprintln!("DEBUG filter_first_hops: called with {} first_hops", first_hops.len());
971930
let kv_store = get_rgb_kv_store(ldk_data_dir).expect("KVStore must be initialized");
972931
let rgb_payment_info = read_rgb_payment_info_kv(kv_store.as_ref(), payment_hash, false)
973932
.expect("payment info must exist");
974933
let contract_id = rgb_payment_info.contract_id;
975934
let rgb_amount = rgb_payment_info.amount;
976-
eprintln!(
977-
"DEBUG filter_first_hops: looking for contract_id={}, rgb_amount={}",
978-
contract_id, rgb_amount
979-
);
980935
first_hops.retain(|h| {
981936
let channel_id_str = h.channel_id.0.as_hex().to_string();
982-
eprintln!("DEBUG filter_first_hops: checking channel {}", channel_id_str);
983937
match read_rgb_channel_info_kv(kv_store.as_ref(), &channel_id_str, false) {
984938
Ok(rgb_info) => {
985-
let matches = rgb_info.contract_id == contract_id && rgb_info.local_rgb_amount >= rgb_amount;
986-
eprintln!("DEBUG filter_first_hops: channel {} found, contract_id={}, local_rgb_amount={}, matches={}",
987-
channel_id_str, rgb_info.contract_id, rgb_info.local_rgb_amount, matches);
988-
matches
989-
}
990-
Err(e) => {
991-
eprintln!("DEBUG filter_first_hops: channel {} NOT found in KVStore: {:?}", channel_id_str, e);
992-
false
939+
rgb_info.contract_id == contract_id && rgb_info.local_rgb_amount >= rgb_amount
993940
}
941+
Err(_) => false,
994942
}
995943
});
996-
eprintln!(
997-
"DEBUG filter_first_hops: after filtering, {} first_hops remaining",
998-
first_hops.len()
999-
);
1000944
(contract_id, rgb_amount)
1001945
}
1002946

0 commit comments

Comments
 (0)