- If a path within a route passes through the same channelID twice,
that shows the path is looped and will be rejected by nodes.
- Add a check to explicitly reject such payment before trying to send
them.
continue 'path_check;
}
}
+ for (i, hop) in path.hops.iter().enumerate() {
+ // Check for duplicate channel_id in the remaining hops of the path
+ if path.hops.iter().skip(i + 1).any(|other_hop| other_hop.short_channel_id == hop.short_channel_id) {
+ path_errs.push(Err(APIError::InvalidRoute{err: "Path went through the same channel twice".to_owned()}));
+ continue 'path_check;
+ }
+ }
total_value += path.final_value_msat();
path_errs.push(Ok(()));
}