Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-611: Accountant Overlapping Scans (self review) #4

Open
wants to merge 147 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
a08797e
GH-611: add test to scan for payables in case flag is false
utkarshg6 Jul 4, 2022
31f4356
GH-611: add one more test and todos for Scanner
utkarshg6 Jul 6, 2022
9d3b3f0
GH-611: change Scanner from a trait to struct
utkarshg6 Jul 7, 2022
d2e428b
GH-611: use RefCell to eliminate the problem with mutable closure ins…
utkarshg6 Jul 7, 2022
b82293b
GH-611: remove redundant fields from tools.rs
utkarshg6 Jul 8, 2022
f54ef5a
GH-611: migrate flag from Accountant to Scanner
utkarshg6 Jul 8, 2022
ba036ca
GH-611: fix test accountant_have_proper_defaulted_values
utkarshg6 Jul 8, 2022
cea6870
GH-611: rename items in tools.rs
utkarshg6 Jul 8, 2022
a97f6ac
GH-611: add functions to update flag for is_scan_running
utkarshg6 Jul 8, 2022
0815a87
GH-611: add a TODO for verifying that scanners are defaulted properly
utkarshg6 Jul 8, 2022
b3e34f5
GH-611: throw error when scan is already running.
utkarshg6 Jul 8, 2022
fa30d82
GH-611: add a todo to handle the case when UI triggers a scan, but th…
utkarshg6 Jul 11, 2022
9f6639b
GH-611: allow scan is running error logs to print the scan type
utkarshg6 Jul 11, 2022
0010876
GH-611: write logs whenever a new scan is requested but scan is alrea…
utkarshg6 Jul 11, 2022
697ecd0
GH-611: rename the module to scanners
utkarshg6 Jul 11, 2022
dc85535
GH-611: use timestamp instead of boolean flag for marking whether a s…
utkarshg6 Jul 12, 2022
b79ad8b
GH-611: change the logs to include timestamp in case scan is already …
utkarshg6 Jul 12, 2022
30dc1ed
GH-611: add todos for ending scans for PendingPayables
utkarshg6 Jul 12, 2022
4109f9b
GH-611: use a RefCell to update the initiated_at variable
utkarshg6 Jul 15, 2022
6a81fdf
GH-611: add a test for testing whether scan has started
utkarshg6 Jul 13, 2022
b4502c4
GH-611: use mark_as_started() in the scan()
utkarshg6 Jul 15, 2022
52fac77
GH-611: end the scan for payables at handle_sent_payable()
utkarshg6 Jul 15, 2022
4ba15cf
GH-611: allow blockchain bridge to send ReportTransactionReceipts wit…
utkarshg6 Jul 15, 2022
12aecc8
GH-611: disable starting and ending the scans to fix the tests in acc…
utkarshg6 Jul 20, 2022
b4753bb
GH-611: remove compiler warnings
utkarshg6 Jul 21, 2022
9497874
GH-611: scanners struct can be constructed with the respective scanners
utkarshg6 Jul 21, 2022
4f7fbd2
GH-611: eliminate the BeginMessageWrapper
utkarshg6 Jul 22, 2022
57ca413
GH-611: modify PayableDAOMock
utkarshg6 Jul 22, 2022
3e9651d
GH-611: modify PendingPayableDaoFactoryMock and ReceivableDaoFactoryMock
utkarshg6 Jul 25, 2022
9fe65c7
GH-611: supply DAOs for Scanner inside the tests of accountant/mod.rs
utkarshg6 Jul 25, 2022
10e197f
GH-611: introduce scanner mock
utkarshg6 Aug 9, 2022
7836d8f
GH-611: modify ScannerMock and replace NullScanner with ScannerMock
utkarshg6 Aug 16, 2022
b0a08d4
GH-611: an attempt to migrate the contents of scan_for_payables() ins…
utkarshg6 Aug 17, 2022
c8a3da8
GH-611: remove ctx and comment out code
utkarshg6 Aug 17, 2022
4224f93
GH-611: remove the commented out code
utkarshg6 Aug 17, 2022
8289362
GH-611: add a todo!() inside payable_exceeded_threshold() to generate…
utkarshg6 Aug 17, 2022
b890f0d
GH-611: write test for payable_thresholds_real
utkarshg6 Aug 17, 2022
f346446
GH-611: get rid of copy from structs in accountant.rs
utkarshg6 Aug 17, 2022
ee05a14
GH-611: pull out payment_thresholds out of accountant_config and dist…
utkarshg6 Aug 19, 2022
2ac9e65
GH-611: refactor tools for Payable Scanner
utkarshg6 Aug 19, 2022
78571f5
GH-611: migrate the payable scanner tools to the tools.rs
utkarshg6 Aug 19, 2022
889bda0
GH-611: Add a todo and comment out the test
utkarshg6 Aug 22, 2022
05c5d0e
GH-611: refactor tools.rs
utkarshg6 Aug 22, 2022
0611254
GH-611: fix qualified_payables_and_summary()
utkarshg6 Aug 25, 2022
5ea8a61
GH-611: test drive the checks for whether a payable is qualified
utkarshg6 Aug 25, 2022
dfbfd11
GH-611: migrate test for testing debt extremes inside tools.rs
utkarshg6 Aug 25, 2022
f811931
GH-611: refactor the investigate_debt_extremes()
utkarshg6 Aug 25, 2022
6c51328
GH-611: migrate tools for payable_scanner inside a different module
utkarshg6 Aug 26, 2022
c31e28a
GH-611: add test for payable_scanner for initiating a scan
utkarshg6 Aug 26, 2022
6b749a1
GH-611: add tests for pending payable initating a scan
utkarshg6 Aug 26, 2022
383fe72
GH-611: extend tests to assert for log messages
utkarshg6 Aug 29, 2022
79f94fe
GH-611: migrate the scan_for_receivables to the begin_scan()
utkarshg6 Aug 29, 2022
8838191
GH-611: add test for scanning for delinquency
utkarshg6 Aug 30, 2022
9aba854
GH-611: remove referenced counter from the payable_scanner_tools
utkarshg6 Aug 30, 2022
682f81f
GH-611: remove some import warnings
utkarshg6 Aug 30, 2022
1cfd92e
GH-611: generate timestamp inside begin_scan()
utkarshg6 Aug 30, 2022
0f03db9
GH-611: modify BannedDaoFactoryMock
utkarshg6 Aug 31, 2022
95464e3
GH-611: fix test accountant_sends_report_accounts_payable_to_blockcha…
utkarshg6 Aug 31, 2022
ea1049c
GH-611: fix the test accountant_sends_a_request_to_blockchain_bridge_…
utkarshg6 Sep 1, 2022
d451a7e
GH-611: fix test scan_for_pending_payable_found_unresolved_pending_pa…
utkarshg6 Sep 1, 2022
634b49d
GH-611: remove the code from accountant/mod.rs that has been moved to…
utkarshg6 Sep 1, 2022
5473ad7
GH-611: add ScannerError
utkarshg6 Sep 1, 2022
4c3248d
GH-611: fix accountant_scans_after_startup
utkarshg6 Sep 1, 2022
534197e
GH-611: refactor handlers for scan requests in accountant/mod.rs
utkarshg6 Sep 1, 2022
83071da
GH-611: fix more tests inside accountant/mod.rs
utkarshg6 Sep 1, 2022
d5e37b1
GH-611: reorder dao in tests for Accountant and Scanner, and replace …
utkarshg6 Sep 2, 2022
1bc0b46
GH-611: use the timestamp from the function parameter for scanners
utkarshg6 Sep 2, 2022
9a25fd3
GH-611: refactor the handlers for scan requests
utkarshg6 Sep 2, 2022
ce632e9
GH-611: fix tests related to externally triggered scan
utkarshg6 Sep 2, 2022
376362f
GH-611: fix test accountant_payable_scan_timer_triggers_periodical_sc…
utkarshg6 Sep 6, 2022
7067cd4
GH-611: fix test periodical_scanning_for_pending_payable_works
utkarshg6 Sep 6, 2022
7b7c2fa
GH-611: fix periodical_scanning_for_receivables_and_delinquencies_works
utkarshg6 Sep 6, 2022
51f36d1
GH-611: begin_scan() updates the timestamp
utkarshg6 Sep 6, 2022
6541f58
GH-611: remove unnecessary test
utkarshg6 Sep 6, 2022
1cf2036
GH-611: throw error in case scan is already running
utkarshg6 Sep 6, 2022
c092240
GH-611: handle error message ScanAlreadyRunning
utkarshg6 Sep 6, 2022
d8ac816
GH-611: fix tests for when the scan is already running
utkarshg6 Sep 7, 2022
80ebc6f
GH-611: remove commented code and change the test name to periodical_…
utkarshg6 Sep 7, 2022
a99eec2
GH-611: remove warnings
utkarshg6 Sep 7, 2022
de012bc
GH-611: add timestamp as a paramneter in the function investigate_deb…
utkarshg6 Sep 7, 2022
180bde6
Test is passing
dnwiebe Sep 7, 2022
b25b9c0
Merged
dnwiebe Sep 7, 2022
2f4f0a5
GH-611: remove the warnings
utkarshg6 Sep 9, 2022
89dc532
GH-611: refactor test scan_for_payable_message_triggers_payment_for_b…
utkarshg6 Sep 12, 2022
40b779e
GH-611: decouple pending payable and payable daos inside test pending…
utkarshg6 Sep 13, 2022
deec7a2
GH-611: provide correct DAOs to the Accountant after migrating handle…
utkarshg6 Sep 14, 2022
9623e4a
GH-611: fix tests in accountant to call scan_finished() directly
utkarshg6 Sep 14, 2022
ba35d44
GH-611: migrate all code of handle_sent_payable() to scan_finished() …
utkarshg6 Sep 14, 2022
e746614
GH-611: throw errors when a problem happens while handling SentPayabl…
utkarshg6 Sep 14, 2022
7ce2fb8
GH-611: migrate seperate_early_errors to tools.rs finished
utkarshg6 Sep 14, 2022
f49828f
GH-611: remove commented out from accountant/mod.rs
utkarshg6 Sep 14, 2022
0bcac3d
GH-611: return an option of NodeToUiMessage from the scan_finished()
utkarshg6 Sep 14, 2022
9727c7c
GH-611: format the error messages inside scanners.rs
utkarshg6 Sep 15, 2022
1f5b604
GH-611: refactor scan_finished() of PayableScanner
utkarshg6 Sep 15, 2022
ec5928f
GH-611: migration to scan_finished() for PendingPayableScanner in pro…
utkarshg6 Sep 15, 2022
f6a0c9a
GH-611: directly store fields of accountant config inside Accountant
utkarshg6 Sep 16, 2022
feda807
GH-611: pull fields of accountant config outside
utkarshg6 Sep 16, 2022
96a91d5
GH-611: refactor utility fn to build bootstrapper config with defaults
utkarshg6 Sep 16, 2022
1213b02
GH-611: comment out AccountantConfig
utkarshg6 Sep 16, 2022
bb439fb
GH-611: migrate process_transaction_by_status() to the scanners.rs
utkarshg6 Sep 16, 2022
5348821
GH-611: return errors instead of panicking inside PendingPayable Scanner
utkarshg6 Sep 19, 2022
d529671
GH-611: pass payable dao inside pending payable scanner
utkarshg6 Sep 19, 2022
13e9b3b
GH-611: share FinancialStatistics with the PendingPayableScanner
utkarshg6 Sep 20, 2022
fe58162
GH-611: fix AccountantBuilder's default configuration
utkarshg6 Sep 20, 2022
04a63e2
GH-611: supply PayableDAO for PendingPayableScanner inside tests
utkarshg6 Sep 20, 2022
d664e24
GH-611: fix the handler for the PendingPayable Scanner
utkarshg6 Sep 20, 2022
b8c92e0
GH-611: rename individual scanner in Scanners struct
utkarshg6 Sep 20, 2022
9f942b6
GH-611: migrate test interpret_transaction_receipt_when_transaction_s…
utkarshg6 Sep 20, 2022
839d1fb
GH-611: migrate test interpret_transaction_receipt_when_transaction_s…
utkarshg6 Sep 20, 2022
b9f050c
GH-611: migrate interpret_transaction_receipt_panics_at_undefined_sta…
utkarshg6 Sep 20, 2022
3436aec
GH-611: rename the panic message
utkarshg6 Sep 21, 2022
6bb2dfa
GH-611: migrate test interpret_transaction_receipt_when_transaction_s…
utkarshg6 Sep 21, 2022
9d9f450
GH-611: migrate handle_pending_tx_handles_none_returned_for_transacti…
utkarshg6 Sep 21, 2022
3d14e07
GH-611: migrate test for report transaction receipts message into sca…
utkarshg6 Sep 21, 2022
47514eb
GH-611: remove unnecessary code from accountant.rs
utkarshg6 Sep 21, 2022
0c04321
GH-611: migrate some functions for PendingPayable Scanner to tools.rs
utkarshg6 Sep 21, 2022
24c6a06
GH-611: reorder items inside accountant.rs
utkarshg6 Sep 21, 2022
ee7ed64
GH-611: migrate tests for CancelPendingTransactions inside scanners.rs
utkarshg6 Sep 21, 2022
54e71ed
GH-611: remove the CancelFailedPendingTransaction message
utkarshg6 Sep 21, 2022
d25e290
GH-611: migrate tests for update_payable_fingerprint()
utkarshg6 Sep 21, 2022
6325fcd
GH-611: migrate tests for confirming pending transactions to scanners.rs
utkarshg6 Sep 21, 2022
9c342a1
GH-611: remove transaction confirmation tools
utkarshg6 Sep 21, 2022
99d30dc
GH-611: migrate handling of ReceivedPayments message to the scan_fini…
utkarshg6 Sep 21, 2022
86c4c22
GH-611: use mark_as_started() to update the timestamp inside Scanners
utkarshg6 Sep 22, 2022
04bb7da
GH-611: reanme ScannerError to BeginScanError
utkarshg6 Sep 22, 2022
0f0eafc
GH-611: replace Errors into panics inside scan_finished() of all the …
utkarshg6 Sep 22, 2022
249097a
GH-611: modify tests for Scanners to assert whether scan_finished() s…
utkarshg6 Sep 22, 2022
ff347d3
GH-611: add logging when scan has ended
utkarshg6 Sep 22, 2022
4faf4d4
GH-611: fix test for the periodical scanning of Payable Scanner
utkarshg6 Sep 22, 2022
40bd90e
GH-611: use ScannerMock for testing periodical scanning for payables
utkarshg6 Sep 23, 2022
658c719
GH-611: fix test for the periodical scanning of receivables and deliq…
utkarshg6 Sep 23, 2022
40f9ba3
GH-611: fix test for periodical scanning for pending payables
utkarshg6 Sep 23, 2022
bb2733c
GH-611: rename the fn name for stopping the system inside ScannerMock
utkarshg6 Sep 23, 2022
3838826
GH-611: remove import warnings
utkarshg6 Sep 23, 2022
c23448e
GH-611: improve the implementation of ScannerMock
utkarshg6 Sep 23, 2022
167b276
GH-611: end the scan in case begin_scan() returns an error of nothing…
utkarshg6 Sep 23, 2022
48a06af
GH-611: refactor begin_scan() for Receivable Scanner
utkarshg6 Sep 23, 2022
d5ffcea
GH-611: remove an obsolete assert realted to threshold tools
utkarshg6 Sep 23, 2022
52bfd0c
GH-611: fix the test pending_transaction_is_registered_and_monitored_…
utkarshg6 Sep 23, 2022
53a66e6
GH-611: refactor scanners.rs
utkarshg6 Sep 26, 2022
482b8ae
GH-611: use default implementation of PaymentThresholds
utkarshg6 Sep 28, 2022
1af6f2b
GH-611: migrate the test utility functions of scanner.rs to accountan…
utkarshg6 Sep 28, 2022
6e3dd00
GH-611: remove BannedDao and PaymentThresholds as a field of Accountant
utkarshg6 Sep 28, 2022
6ab9c9b
GH-611: implement scan_finished() for ScannerMock
utkarshg6 Sep 28, 2022
b4389cf
GH-611: remove multiple occurences of BannedDao inside tests of accou…
utkarshg6 Sep 28, 2022
8b73e99
GH-611: rename scan_finished() to finish_scan()
utkarshg6 Sep 28, 2022
f3739b1
Merge branch 'master' into GH-611
utkarshg6 Sep 29, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,235 changes: 1,235 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions masq_lib/src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -686,10 +686,10 @@ mod tests {
let one_logger = Logger::new("logger_format_is_correct_one");
let another_logger = Logger::new("logger_format_is_correct_another");

let before = OffsetDateTime::now_utc();
let before = SystemTime::now();
error!(one_logger, "one log");
error!(another_logger, "another log");
let after = OffsetDateTime::now_utc();
let after = SystemTime::now();

let tlh = TestLogHandler::new();
let prefix_len = "0000-00-00T00:00:00.000".len();
Expand All @@ -702,8 +702,8 @@ mod tests {
" Thd{}: ERROR: logger_format_is_correct_another: another log",
thread_id_as_string(thread_id)
)));
let before_str = timestamp_as_string(before);
let after_str = timestamp_as_string(after);
let before_str = timestamp_as_string(&before);
let after_str = timestamp_as_string(&after);
assert_between(&one_log[..prefix_len], &before_str, &after_str);
assert_between(&another_log[..prefix_len], &before_str, &after_str);
}
Expand Down Expand Up @@ -872,7 +872,7 @@ mod tests {
tlh.exists_log_containing("error! 42");
}

fn timestamp_as_string(timestamp: OffsetDateTime) -> String {
pub fn timestamp_as_string(timestamp: OffsetDateTime) -> String {
timestamp
.format(&parse(TIME_FORMATTING_STRING).unwrap())
.unwrap()
Expand Down
Loading