35 namespace graphene {
namespace chain {
43 const auto& db = *
this;
50 const auto& htlcs = db.get_index_type<
htlc_index>().indices();
51 map<asset_id_type,share_type> total_balances;
52 map<asset_id_type,share_type> total_debts;
59 total_balances[a.asset_type] += a.balance;
63 total_balances[s.balance.asset_id] += s.balance.amount;
66 total_balances[ vbo.balance.asset_id ] += vbo.balance.amount;
68 total_balances[ asset_id_type() ] += fba.accumulated_fba_fees;
72 reported_core_in_orders += s.total_core_in_orders;
75 total_balances[b.inv_swan_price.base.asset_id] += b.inv_swan_price.base.amount;
79 auto for_sale = o.amount_for_sale();
80 if( for_sale.asset_id == asset_id_type() ) core_in_orders += for_sale.amount;
81 total_balances[for_sale.asset_id] += for_sale.amount;
86 auto col = o.get_collateral();
87 if( col.asset_id == asset_id_type() ) core_in_orders += col.amount;
88 total_balances[col.asset_id] += col.amount;
89 total_debts[o.get_debt().asset_id] += o.get_debt().amount;
93 total_balances[asset_obj.get_id()] += asset_obj.dynamic_asset_data_id(db).accumulated_fees;
94 total_balances[asset_id_type()] += asset_obj.dynamic_asset_data_id(db).fee_pool;
97 for(
const auto& htlc : htlcs )
98 total_balances[htlc.transfer.asset_id] += htlc.transfer.amount;
102 FC_THROW(
"computed balance of CORE mismatch",
103 (
"computed value",total_balances[asset_id_type()].value)
119 constexpr uint8_t db_action_nil = 0;
120 constexpr uint8_t db_action_create = 1;
121 constexpr uint8_t db_action_write = 2;
122 constexpr uint8_t db_action_update = 3;
123 constexpr uint8_t db_action_delete = 4;
135 uint8_t action = db_action_nil;
136 auto it_id = vo.
find(
"id");
140 action = ( vo.
size() == 1 ) ? db_action_delete : db_action_write;
144 action = db_action_delete;
145 auto it_action = vo.
find(
"_action" );
146 if( it_action != vo.
end() )
148 const std::string& str_action = it_action->value().get_string();
149 if( str_action ==
"create" )
150 action = db_action_create;
151 else if( str_action ==
"write" )
152 action = db_action_write;
153 else if( str_action ==
"update" )
154 action = db_action_update;
155 else if( str_action ==
"delete" )
156 action = db_action_delete;
163 case db_action_create:
166 case db_action_write:
169 idx.object_default( obj );
170 idx.object_from_variant( vo, obj, GRAPHENE_MAX_NESTED_OBJECTS );
173 case db_action_update:
176 idx.object_from_variant( vo, obj, GRAPHENE_MAX_NESTED_OBJECTS );
179 case db_action_delete:
190 auto it = _node_property_object.
debug_updates.find( head_id );
200 auto it = _node_property_object.
debug_updates.find( head_id );
202 it = _node_property_object.
debug_updates.emplace( head_id, std::vector< fc::variant_object >() ).first;
203 it->second.emplace_back( update );