Skip to content

Commit

Permalink
try to fix bug related to hub trxs
Browse files Browse the repository at this point in the history
  • Loading branch information
justfortest2 committed Jul 29, 2020
1 parent 269dd84 commit baf79cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
17 changes: 9 additions & 8 deletions plugins/ibc_plugin/ibc_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,7 @@ namespace eosio { namespace ibc {
par.table = N(hubtrxs);
par.table_key = "id";
par.lower_bound = to_string(id);
par.upper_bound = "";
par.upper_bound = ""; // to last
par.limit = 1;
par.key_type = "i64";
par.index_position = "1";
Expand Down Expand Up @@ -4217,9 +4217,9 @@ namespace eosio { namespace ibc {
}

auto range = token_contract->get_table_hubtrxs_id_range();
if ( range == range_type() ){
/*if ( range == range_type() ){
return;
}
}*/

//ilog("hub step 2");
/// --- hub_trx_table ---
Expand All @@ -4228,11 +4228,11 @@ namespace eosio { namespace ibc {


while(1) {
/// idump((next_index));
auto hub_trx_opt = token_contract->get_table_hubtrxs_info_by_lower_id( next_index );
if ( hub_trx_opt.valid() ){
hub_trx_table.emplace_back( *hub_trx_opt );
next_index = hub_trx_opt->cash_seq_num + 1;
idump((next_index));
hub_trx_table.push_back( *hub_trx_opt );
next_index = hub_trx_opt->id + 1;
} else {
break;
}
Expand All @@ -4243,7 +4243,8 @@ namespace eosio { namespace ibc {
std::vector<hub_transfer_params> need_transfers;

for( const auto& hub_trx : hub_trx_table ){
if ( hub_trx.hub_trx_id != transaction_id_type() ){
//if ( hub_trx.hub_trx_id != transaction_id_type() ){
if ( hub_trx.hub_trx_time_slot != 0 ){
continue;
}

Expand All @@ -4265,7 +4266,7 @@ namespace eosio { namespace ibc {
continue;
}

need_transfers.emplace_back( par );
need_transfers.push_back( par );
}

//ilog("hub step 4");
Expand Down
4 changes: 2 additions & 2 deletions plugins/ibc_plugin/include/eosio/ibc_plugin/ibc_plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ namespace eosio { namespace ibc {
};

struct hub_trx_info {
uint64_t cash_seq_num;
uint64_t id;
uint64_t cash_time_slot;
name from_chain;
name from_account;
Expand Down Expand Up @@ -247,7 +247,7 @@ FC_REFLECT( eosio::ibc::cashconfirm_action_params, (from_chain)(cash_trx_id)(cas
FC_REFLECT( eosio::ibc::memo_info_type, (receiver)(chain)(notes) )

FC_REFLECT( eosio::ibc::hub_globals, (is_open)(hub_account)(unfinished_trxs) )
FC_REFLECT( eosio::ibc::hub_trx_info, (cash_seq_num)(cash_time_slot)(from_chain)(from_account)(from_quantity)
FC_REFLECT( eosio::ibc::hub_trx_info, (id)(cash_time_slot)(from_chain)(from_account)(from_quantity)
(mini_to_quantity)(orig_trx_id)(to_chain)(to_account)(orig_pure_memo)(to_quantity)(fee_receiver)(hub_trx_id)
(hub_trx_time_slot)(forward_times)(backward_times) )
FC_REFLECT( eosio::ibc::hub_transfer_params, (from)(to)(quantity)(account)(chain)(orig_trx_id)(worker)(memo) )

0 comments on commit baf79cb

Please sign in to comment.