listen
listen copied to clipboard
Computational logic issues about parse_notional function in tx_parser.rs
Description
@piotrostr This function is taking the larger value,I think use Unsigned Absolute Differences: .map(|(a, b)| a.abs_diff(*b)), right?
#[timed(duration(printer = "info!"))]
pub fn parse_notional(
tx: &EncodedConfirmedTransactionWithStatusMeta,
) -> Result<u64, Box<dyn std::error::Error>> {
...
// This calculation is not clear, if a - b is negative, and then forced to convert to u64 will overflow into a very large positive number, may be wrongly considered a large transaction
.map(|(a, b)| (***a as f64 - *b as f64) as u64**)
...
}
Steps to Reproduce
No
Additional Notes
No response
could be, listen-legacy will be sunsetted at some point
for more up-to-date transaction notional parsing, have a look at listen-data-service, the parse_swap.rs