Skip to content

Commit 6b4f5ab

Browse files
committed
change override_route_amount param to bool
1 parent 4bd1d4c commit 6b4f5ab

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lightning/src/ln/channelmanager.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2726,10 +2726,10 @@ where
27262726
let rgb_payment_info_hash_path = self.ldk_data_dir.join(htlc_payment_hash);
27272727
let path = if rgb_payment_info_hash_path.exists() {
27282728
let rgb_payment_info = parse_rgb_payment_info(&rgb_payment_info_hash_path);
2729-
if let Some(override_amount) = rgb_payment_info.override_route_amount {
2729+
if !rgb_payment_info.override_route_amount {
27302730
let mut path = path.clone();
27312731
for hop in &mut path.hops {
2732-
hop.rgb_amount = Some(override_amount);
2732+
hop.rgb_amount = Some(rgb_payment_info.amount);
27332733
}
27342734
path
27352735
} else {

lightning/src/rgb_utils/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ pub struct RgbPaymentInfo {
7676
pub local_rgb_amount: u64,
7777
/// RGB remote amount
7878
pub remote_rgb_amount: u64,
79-
/// Override RGB amount in route
80-
pub override_route_amount: Option<u64>,
79+
/// Whether the RGB amount in route should be overridden
80+
pub override_route_amount: bool,
8181
}
8282

8383
/// RGB transfer info
@@ -174,7 +174,7 @@ pub(crate) fn color_commitment(channel_id: &[u8; 32], funding_outpoint: &OutPoin
174174
amount: htlc.amount_rgb.unwrap(),
175175
local_rgb_amount: rgb_info.local_rgb_amount,
176176
remote_rgb_amount: rgb_info.remote_rgb_amount,
177-
override_route_amount: None,
177+
override_route_amount: false,
178178
};
179179
let serialized_info = serde_json::to_string(&rgb_payment_info).expect("valid rgb payment info");
180180
fs::write(rgb_payment_info_path, serialized_info).expect("able to write rgb payment info file");
@@ -520,7 +520,7 @@ pub fn write_rgb_channel_info(path: &PathBuf, rgb_info: &RgbInfo) {
520520
}
521521

522522
/// Write RGB payment info to file
523-
pub fn write_rgb_payment_info_file(ldk_data_dir: &Path, payment_hash: &PaymentHash, contract_id: ContractId, amount_rgb: u64, override_route_amount: Option<u64>) {
523+
pub fn write_rgb_payment_info_file(ldk_data_dir: &Path, payment_hash: &PaymentHash, contract_id: ContractId, amount_rgb: u64, override_route_amount: bool) {
524524
let rgb_payment_info_path = ldk_data_dir.join(hex::encode(payment_hash.0));
525525
let rgb_payment_info = RgbPaymentInfo {
526526
contract_id,

0 commit comments

Comments
 (0)