From 170bcb56a98c70609c4bb8d6a8558c831eae1b67 Mon Sep 17 00:00:00 2001 From: qima Date: Tue, 2 Apr 2024 13:14:49 +0800 Subject: [PATCH] fix(node): disable records_stored bad quote detection due to new work --- sn_networking/src/driver.rs | 4 ++-- sn_transfers/src/wallet/data_payments.rs | 25 ++++++++++++++---------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/sn_networking/src/driver.rs b/sn_networking/src/driver.rs index 71e825dae7..b5de0c6aa7 100644 --- a/sn_networking/src/driver.rs +++ b/sn_networking/src/driver.rs @@ -635,8 +635,8 @@ impl SwarmDriver { // -------------------------------------------- /// Return a far address, close to but probably farther than our responsibilty range. - /// This simply uses the closest k peers to estimate the farthest address as CLOSE_GROUP_SIZE + 1 peer's - /// address distance. + /// This simply uses the closest k peers to estimate the farthest address as + /// `CLOSE_GROUP_SIZE + 1`th peer's address distance. fn get_farthest_relevant_address_estimate( &mut self, // Sorted list of closest k peers to our peer id. diff --git a/sn_transfers/src/wallet/data_payments.rs b/sn_transfers/src/wallet/data_payments.rs index b757e58bd0..9305db9cd8 100644 --- a/sn_transfers/src/wallet/data_payments.rs +++ b/sn_transfers/src/wallet/data_payments.rs @@ -207,16 +207,21 @@ impl PaymentQuote { return false; } - // There could be pruning to be undertaken, - // hence the `increasement` check only valid when not being too full. - if new_quote.quoting_metrics.close_records_stored + 20 - < new_quote.quoting_metrics.max_records - && new_quote.quoting_metrics.close_records_stored - < old_quote.quoting_metrics.close_records_stored - { - info!("claimed records_stored out of sequence"); - return false; - } + // // There could be pruning to be undertaken, + // // hence the `increasement` check only valid when not being too full. + // // As now using the `close_records_stored`, with the changing range, + // // there is chance that a newer close_records_stored will be smaller than old ones + // // + // // TODO: rethink about the detection policy on this part + // + // if new_quote.quoting_metrics.close_records_stored + 20 + // < new_quote.quoting_metrics.max_records + // && new_quote.quoting_metrics.close_records_stored + // < old_quote.quoting_metrics.close_records_stored + // { + // info!("claimed records_stored out of sequence"); + // return false; + // } // TODO: Double check if this applies, as this will prevent a node restart with same ID if new_quote.quoting_metrics.received_payment_count