* rollback storage, and store the init storage in thinkyoung * arg1 is contract */
| 1051 | * arg1 is contract |
| 1052 | */ |
| 1053 | static int rollback_storage(lua_State *L) |
| 1054 | { |
| 1055 | if (lua_gettop(L) < 1) |
| 1056 | { |
| 1057 | global_glua_chain_api->throw_exception(L, THINKYOUNG_API_SIMPLE_ERROR, "rollback_storage need 1 arguments"); |
| 1058 | thinkyoung::lua::lib::notify_lua_state_stop(L); |
| 1059 | return 0; |
| 1060 | } |
| 1061 | if (!lua_istable(L, 1)) |
| 1062 | { |
| 1063 | global_glua_chain_api->throw_exception(L, THINKYOUNG_API_SIMPLE_ERROR, "first argument of rollback_storage must be contract"); |
| 1064 | return 0; |
| 1065 | } |
| 1066 | lua_getfield(L, 1, "name"); |
| 1067 | auto contract_name = (const char*)luaL_checkstring(L, -1); |
| 1068 | if (!contract_name) |
| 1069 | contract_name = empty_string; |
| 1070 | printf("rollback storage\n"); |
| 1071 | return 0; |
| 1072 | } |
| 1073 | |
| 1074 | static const luaL_Reg thinkyounglib[] = { |
| 1075 | { "check", unit_test_check }, |
nothing calls this directly
no test coverage detected