Skip to content

Commit

Permalink
review(onur): do the same for tendermint history state machine
Browse files Browse the repository at this point in the history
  • Loading branch information
mariocynicys committed Nov 6, 2024
1 parent 65bd662 commit e65ace0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mm2src/coins/tendermint/tendermint_tx_history_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ impl CoinWithTxHistoryV2 for TendermintToken {
struct TendermintTxHistoryStateMachine<Coin: CoinCapabilities, Storage: TxHistoryStorage> {
coin: Coin,
storage: Storage,
streaming_manager: StreamingManager,
balances: AllBalancesResult,
last_received_page: u32,
last_spent_page: u32,
Expand Down Expand Up @@ -573,6 +574,7 @@ where
address: String,
coin: &Coin,
storage: &Storage,
streaming_manager: &StreamingManager,
query: String,
from_height: u64,
page: &mut u32,
Expand All @@ -589,7 +591,6 @@ where
"could not get rpc client"
);

let streaming_manager: StreamingManager = panic!();
loop {
let response = try_or_return_stopped_as_err!(
client
Expand Down Expand Up @@ -788,6 +789,7 @@ where
self.address.clone(),
&ctx.coin,
&ctx.storage,
&ctx.streaming_manager,
q,
self.from_block_height,
&mut ctx.last_spent_page,
Expand All @@ -810,6 +812,7 @@ where
self.address.clone(),
&ctx.coin,
&ctx.storage,
&ctx.streaming_manager,
q,
self.from_block_height,
&mut ctx.last_received_page,
Expand Down Expand Up @@ -923,7 +926,7 @@ fn get_value_from_event_attributes(events: &[EventAttribute], tag: &str, base64_
pub async fn tendermint_history_loop(
coin: TendermintCoin,
storage: impl TxHistoryStorage,
_ctx: MmArc,
ctx: MmArc,
_current_balance: Option<BigDecimal>,
) {
let balances = match coin.get_all_balances().await {
Expand All @@ -937,6 +940,7 @@ pub async fn tendermint_history_loop(
let mut state_machine = TendermintTxHistoryStateMachine {
coin,
storage,
streaming_manager: ctx.event_stream_manager.clone(),
balances,
last_received_page: 1,
last_spent_page: 1,
Expand Down

0 comments on commit e65ace0

Please sign in to comment.