-
Notifications
You must be signed in to change notification settings - Fork 32
GH-689: Amend scanner scheduling: Handling ScanError msg #691
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,7 @@ use crate::db_config::config_dao::ConfigDaoReal; | |
| use crate::db_config::persistent_configuration::{ | ||
| PersistentConfiguration, PersistentConfigurationReal, | ||
| }; | ||
| use crate::sub_lib::accountant::DetailedScanType; | ||
| use crate::sub_lib::blockchain_bridge::{BlockchainBridgeSubs, OutboundPaymentsInstructions}; | ||
| use crate::sub_lib::peer_actors::BindMessage; | ||
| use crate::sub_lib::utils::{db_connection_launch_panic, handle_ui_crash_request}; | ||
|
|
@@ -123,7 +124,7 @@ impl Handler<RetrieveTransactions> for BlockchainBridge { | |
| ) -> <Self as Handler<RetrieveTransactions>>::Result { | ||
| self.handle_scan_future( | ||
| Self::handle_retrieve_transactions, | ||
| ScanType::Receivables, | ||
| DetailedScanType::Receivables, | ||
| msg, | ||
| ) | ||
| } | ||
|
|
@@ -135,7 +136,7 @@ impl Handler<RequestTransactionReceipts> for BlockchainBridge { | |
| fn handle(&mut self, msg: RequestTransactionReceipts, _ctx: &mut Self::Context) { | ||
| self.handle_scan_future( | ||
| Self::handle_request_transaction_receipts, | ||
| ScanType::PendingPayables, | ||
| DetailedScanType::PendingPayables, | ||
| msg, | ||
| ) | ||
| } | ||
|
|
@@ -145,7 +146,13 @@ impl Handler<QualifiedPayablesMessage> for BlockchainBridge { | |
| type Result = (); | ||
|
|
||
| fn handle(&mut self, msg: QualifiedPayablesMessage, _ctx: &mut Self::Context) { | ||
| self.handle_scan_future(Self::handle_qualified_payable_msg, ScanType::Payables, msg); | ||
| self.handle_scan_future( | ||
| Self::handle_qualified_payable_msg, | ||
| todo!( | ||
| "This needs to be decided on GH-605. Look what mode you run and set it accordingly" | ||
| ), | ||
| msg, | ||
| ); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| } | ||
|
|
||
|
|
@@ -155,7 +162,9 @@ impl Handler<OutboundPaymentsInstructions> for BlockchainBridge { | |
| fn handle(&mut self, msg: OutboundPaymentsInstructions, _ctx: &mut Self::Context) { | ||
| self.handle_scan_future( | ||
| Self::handle_outbound_payments_instructions, | ||
| ScanType::Payables, | ||
| todo!( | ||
| "This needs to be decided on GH-605. Look what mode you run and set it accordingly" | ||
| ), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Outbound Payments Handler Contains Unresolved TodoThe |
||
| msg, | ||
| ) | ||
| } | ||
|
|
@@ -440,7 +449,7 @@ impl BlockchainBridge { | |
| ) | ||
| } | ||
|
|
||
| fn handle_scan_future<M, F>(&mut self, handler: F, scan_type: ScanType, msg: M) | ||
| fn handle_scan_future<M, F>(&mut self, handler: F, scan_type: DetailedScanType, msg: M) | ||
| where | ||
| F: FnOnce(&mut BlockchainBridge, M) -> Box<dyn Future<Item = (), Error = String>>, | ||
| M: SkeletonOptHolder, | ||
|
|
@@ -562,15 +571,10 @@ mod tests { | |
| use crate::node_test_utils::check_timestamp; | ||
| use crate::sub_lib::blockchain_bridge::ConsumingWalletBalances; | ||
| use crate::test_utils::persistent_configuration_mock::PersistentConfigurationMock; | ||
| use crate::test_utils::recorder::{ | ||
| make_accountant_subs_from_recorder, make_recorder, peer_actors_builder, | ||
| }; | ||
| use crate::test_utils::recorder::{make_accountant_subs_from_recorder, make_blockchain_bridge_subs_from_recorder, make_recorder, peer_actors_builder}; | ||
| use crate::test_utils::recorder_stop_conditions::StopConditions; | ||
| use crate::test_utils::unshared_test_utils::arbitrary_id_stamp::ArbitraryIdStamp; | ||
| use crate::test_utils::unshared_test_utils::{ | ||
| assert_on_initialization_with_panic_on_migration, configure_default_persistent_config, | ||
| prove_that_crash_request_handler_is_hooked_up, AssertionsMessage, ZERO, | ||
| }; | ||
| use crate::test_utils::unshared_test_utils::{assert_on_initialization_with_panic_on_migration, configure_default_persistent_config, prove_that_crash_request_handler_is_hooked_up, AssertionsMessage, SubsFactoryTestAddrLeaker, ZERO}; | ||
| use crate::test_utils::{make_paying_wallet, make_wallet}; | ||
| use actix::System; | ||
| use ethereum_types::U64; | ||
|
|
@@ -601,6 +605,17 @@ mod tests { | |
| } | ||
| } | ||
|
|
||
| impl SubsFactory<BlockchainBridge, BlockchainBridgeSubs> | ||
| for SubsFactoryTestAddrLeaker<BlockchainBridge> | ||
utkarshg6 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| fn make(&self, addr: &Addr<BlockchainBridge>) -> BlockchainBridgeSubs { | ||
| self.send_leaker_msg_and_return_meaningless_subs( | ||
| addr, | ||
| make_blockchain_bridge_subs_from_recorder, | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| fn constants_have_correct_values() { | ||
| assert_eq!(CRASH_KEY, "BLOCKCHAINBRIDGE"); | ||
|
|
@@ -1016,7 +1031,7 @@ mod tests { | |
| assert_eq!( | ||
| *scan_error_msg, | ||
| ScanError { | ||
| scan_type: ScanType::Payables, | ||
| scan_type: DetailedScanType::NewPayables, | ||
| response_skeleton_opt: Some(ResponseSkeleton { | ||
| client_id: 1234, | ||
| context_id: 4321 | ||
|
|
@@ -1267,7 +1282,7 @@ mod tests { | |
| assert_eq!( | ||
| scan_error, | ||
| &ScanError { | ||
| scan_type: ScanType::Receivables, | ||
| scan_type: DetailedScanType::Receivables, | ||
| response_skeleton_opt: None, | ||
| msg: "Error while retrieving transactions: QueryFailed(\"Transport error: Error(IncompleteMessage)\")".to_string() | ||
| } | ||
|
|
@@ -1403,7 +1418,7 @@ mod tests { | |
|
|
||
| let _ = subject.handle_scan_future( | ||
| BlockchainBridge::handle_request_transaction_receipts, | ||
| ScanType::PendingPayables, | ||
| DetailedScanType::PendingPayables, | ||
| msg, | ||
| ); | ||
|
|
||
|
|
@@ -1412,7 +1427,7 @@ mod tests { | |
| assert_eq!( | ||
| recording.get_record::<ScanError>(0), | ||
| &ScanError { | ||
| scan_type: ScanType::PendingPayables, | ||
| scan_type: DetailedScanType::PendingPayables, | ||
| response_skeleton_opt: None, | ||
| msg: "Blockchain error: Query failed: Transport error: Error(IncompleteMessage)" | ||
| .to_string() | ||
|
|
@@ -1781,7 +1796,7 @@ mod tests { | |
| assert_eq!( | ||
| scan_error_msg, | ||
| &ScanError { | ||
| scan_type: ScanType::Receivables, | ||
| scan_type: DetailedScanType::Receivables, | ||
| response_skeleton_opt: Some(ResponseSkeleton { | ||
| client_id: 1234, | ||
| context_id: 4321 | ||
|
|
@@ -1841,7 +1856,7 @@ mod tests { | |
| assert_eq!( | ||
| scan_error_msg, | ||
| &ScanError { | ||
| scan_type: ScanType::Receivables, | ||
| scan_type: DetailedScanType::Receivables, | ||
| response_skeleton_opt: Some(ResponseSkeleton { | ||
| client_id: 1234, | ||
| context_id: 4321 | ||
|
|
@@ -1987,7 +2002,7 @@ mod tests { | |
|
|
||
| subject.handle_scan_future( | ||
| BlockchainBridge::handle_retrieve_transactions, | ||
| ScanType::Receivables, | ||
| DetailedScanType::Receivables, | ||
| retrieve_transactions, | ||
| ); | ||
|
|
||
|
|
@@ -2041,7 +2056,7 @@ mod tests { | |
|
|
||
| subject.handle_scan_future( | ||
| BlockchainBridge::handle_retrieve_transactions, | ||
| ScanType::Receivables, | ||
| DetailedScanType::Receivables, | ||
| msg.clone(), | ||
| ); | ||
|
|
||
|
|
@@ -2051,7 +2066,7 @@ mod tests { | |
| assert_eq!( | ||
| message, | ||
| &ScanError { | ||
| scan_type: ScanType::Receivables, | ||
| scan_type: DetailedScanType::Receivables, | ||
| response_skeleton_opt: msg.response_skeleton_opt, | ||
| msg: "Error while retrieving transactions: QueryFailed(\"RPC error: Error { code: ServerError(-32005), message: \\\"My tummy hurts\\\", data: None }\")" | ||
| .to_string() | ||
|
|
@@ -2190,22 +2205,4 @@ mod tests { | |
| assert_eq!(increase_gas_price_by_margin(1_000_000_000), 1_300_000_000); | ||
| assert_eq!(increase_gas_price_by_margin(9_000_000_000), 11_700_000_000); | ||
| } | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| pub mod exportable_test_parts { | ||
| use super::*; | ||
| use crate::test_utils::recorder::make_blockchain_bridge_subs_from_recorder; | ||
| use crate::test_utils::unshared_test_utils::SubsFactoryTestAddrLeaker; | ||
|
|
||
| impl SubsFactory<BlockchainBridge, BlockchainBridgeSubs> | ||
| for SubsFactoryTestAddrLeaker<BlockchainBridge> | ||
| { | ||
| fn make(&self, addr: &Addr<BlockchainBridge>) -> BlockchainBridgeSubs { | ||
| self.send_leaker_msg_and_return_meaningless_subs( | ||
| addr, | ||
| make_blockchain_bridge_subs_from_recorder, | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.