From 4e8f0b15deddeda7fafcf2776f31ed74126cdb1f Mon Sep 17 00:00:00 2001 From: vonhenry Date: Wed, 22 Jul 2020 16:37:13 +0800 Subject: [PATCH] fix a bug --- ibc.token/include/ibc.token/ibc.token.hpp | 4 ++-- ibc.token/src/ibc.token.cpp | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ibc.token/include/ibc.token/ibc.token.hpp b/ibc.token/include/ibc.token/ibc.token.hpp index fdea27d..82027e5 100644 --- a/ibc.token/include/ibc.token/ibc.token.hpp +++ b/ibc.token/include/ibc.token/ibc.token.hpp @@ -525,7 +525,7 @@ namespace eosio { // code,scope(_self,_self.value) struct [[eosio::table]] hub_trx_info { - uint64_t cash_seq_num; // set by seq_num in cash action + uint64_t id; // set by seq_num in cash action uint64_t cash_time_slot; name from_chain; name from_account; @@ -542,7 +542,7 @@ namespace eosio { uint8_t forward_times; uint8_t backward_times; - uint64_t primary_key()const { return cash_seq_num; } + uint64_t primary_key()const { return id; } fixed_bytes<32> by_orig_trx_id()const { return fixed_bytes<32>(orig_trx_id.hash); } fixed_bytes<32> by_hub_trx_id()const { return fixed_bytes<32>(hub_trx_id.hash); } }; diff --git a/ibc.token/src/ibc.token.cpp b/ibc.token/src/ibc.token.cpp index 7e298b5..bb638f0 100644 --- a/ibc.token/src/ibc.token.cpp +++ b/ibc.token/src/ibc.token.cpp @@ -1550,8 +1550,9 @@ namespace eosio { /// record to hub table auto _hubtrxs = hubtrxs_table( _self, _self.value ); + auto p_id = _hubtrxs.available_primary_key(); _hubtrxs.emplace( _self, [&]( auto& r ) { - r.cash_seq_num = cash_seq_num; + r.id = p_id; /// can not use cash_seq_num, r.cash_time_slot = get_block_time_slot(); r.from_chain = from_chain; r.from_account = from_account;