提交 399e879c 编写于 作者: A arhag

fix eosiod tests by swapping order of generic_currency's account fields to...

fix eosiod tests by swapping order of generic_currency's account fields to match balance serialization assumption in chain_plugin
上级 0d62c0ce
...@@ -58,12 +58,12 @@ namespace eosio { ...@@ -58,12 +58,12 @@ namespace eosio {
}; };
struct account { struct account {
uint64_t symbol = token_type::symbol;
token_type balance; token_type balance;
uint64_t symbol = token_type::symbol;
auto primary_key() const { return symbol; } auto primary_key() const { return symbol; }
EOSLIB_SERIALIZE( account, (symbol)(balance) ) EOSLIB_SERIALIZE( account, (balance)(symbol) )
}; };
struct currency_stats { struct currency_stats {
...@@ -141,6 +141,3 @@ namespace eosio { ...@@ -141,6 +141,3 @@ namespace eosio {
}; };
} /// namespace eosio } /// namespace eosio
...@@ -319,7 +319,7 @@ namespace eosio { namespace testing { ...@@ -319,7 +319,7 @@ namespace eosio { namespace testing {
const auto *obj = db.find<contracts::key_value_object, contracts::by_scope_primary>(boost::make_tuple(tbl->id, asset_symbol.value())); const auto *obj = db.find<contracts::key_value_object, contracts::by_scope_primary>(boost::make_tuple(tbl->id, asset_symbol.value()));
if (obj) { if (obj) {
//balance is the second field after symbol, so skip the symbol //balance is the second field after symbol, so skip the symbol
fc::datastream<const char *> ds(obj->value.data()+sizeof(symbol), obj->value.size()-sizeof(symbol)); fc::datastream<const char *> ds(obj->value.data(), obj->value.size());
fc::raw::unpack(ds, result); fc::raw::unpack(ds, result);
} }
} }
......
...@@ -330,12 +330,12 @@ vector<asset> read_only::get_currency_balance( const read_only::get_currency_bal ...@@ -330,12 +330,12 @@ vector<asset> read_only::get_currency_balance( const read_only::get_currency_bal
fc::raw::unpack(ds, balance); fc::raw::unpack(ds, balance);
auto cursor = asset(balance, symbol(obj.primary_key)); auto cursor = asset(balance, symbol(obj.primary_key));
if (p.symbol || cursor.symbol_name().compare(*p.symbol) == 0) { if( !p.symbol || cursor.symbol_name().compare(*p.symbol) == 0 ) {
results.emplace_back(balance, symbol(obj.primary_key)); results.emplace_back(balance, symbol(obj.primary_key));
} }
// return false if we are looking for one and found it, true otherwise // return false if we are looking for one and found it, true otherwise
return p.symbol || cursor.symbol_name().compare(*p.symbol) != 0; return !p.symbol || cursor.symbol_name().compare(*p.symbol) != 0;
}); });
return results; return results;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册