MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / rollback_storage

Function rollback_storage

src/Chain/libraries/glua/lthinkyounglib.cpp:1053–1072  ·  view source on GitHub ↗

* rollback storage, and store the init storage in thinkyoung * arg1 is contract */

Source from the content-addressed store, hash-verified

1051* arg1 is contract
1052*/
1053static 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
1074static const luaL_Reg thinkyounglib[] = {
1075 { "check", unit_test_check },

Callers

nothing calls this directly

Calls 5

lua_gettopFunction · 0.85
notify_lua_state_stopFunction · 0.85
lua_getfieldFunction · 0.85
printfClass · 0.85
throw_exceptionMethod · 0.45

Tested by

no test coverage detected