@@ -218,6 +218,32 @@ namespace eosiosystem {
218
218
refunds_table.erase ( it );
219
219
}
220
220
221
+ void system_contract::removetable ( name code, uint64_t scope, name table ) {
222
+ require_auth ( code );
223
+
224
+ auto itr = db_end_i64 ( code.value , scope, table.value );
225
+ eosio_assert ( itr != -1 , " table not found" );
226
+
227
+ for ( uint64_t i = 0 ; i < 0x10 ; ++i ) {
228
+ REMOVE_SECONDARY_INDEX ( itr, uint64_t , code.value , scope, table.value | i )
229
+ REMOVE_SECONDARY_INDEX ( itr, uint128_t , code.value , scope, table.value | i )
230
+ REMOVE_SECONDARY_INDEX ( itr, double , code.value , scope, table.value | i )
231
+ REMOVE_SECONDARY_INDEX ( itr, long double , code.value , scope, table.value | i )
232
+ REMOVE_SECONDARY_INDEX ( itr, eosio::key256, code.value , scope, table.value | i )
233
+ // REMOVE_SECONDARY_INDEX( itr, eosio::digest256, code.value, scope, table.value | i )
234
+ }
235
+
236
+ uint64_t pk;
237
+
238
+ itr = db_lowerbound_i64 ( code.value , scope, table.value , std::numeric_limits<uint64_t >::min () );
239
+
240
+ while ( itr > -1 ) {
241
+ auto next_itr = db_next_i64 ( itr, &pk );
242
+ db_remove_i64 ( itr );
243
+ itr = next_itr;
244
+ }
245
+ }
246
+
221
247
/* *
222
248
* Called after a new account is created. This code enforces resource-limits rules
223
249
* for new accounts as well as new account naming conventions.
@@ -308,7 +334,7 @@ EOSIO_DISPATCH( eosiosystem::system_contract,
308
334
// native.hpp (newaccount definition is actually in eosio.system.cpp)
309
335
(newaccount)(updateauth)(deleteauth)(linkauth)(unlinkauth)(canceldelay)(onerror)(setabi)
310
336
// eosio.system.cpp
311
- (init)(setram)(setramrate)(setparams)(setpriv)(setalimits)(rmvproducer)(updtrevision)(bidname)(bidrefund)
337
+ (init)(setram)(setramrate)(setparams)(setpriv)(setalimits)(rmvproducer)(updtrevision)(bidname)(bidrefund)(removetable)
312
338
// delegate_bandwidth.cpp
313
339
(buyrambytes)(buyram)(sellram)(delegatebw)(undelegatebw)(refund)
314
340
// voting.cpp
0 commit comments