My contract has two tables mcat
and mcatmig
.
Problem: scope request return wrong table name mcat........1
instead of mcatmig
:
% cleos get scope teresacode
{
"rows": [{
"code": "teresacode",
"scope": "default",
"table": "mcat",
"payer": "teresacode",
"count": 5688
},{
"code": "teresacode",
"scope": "default",
"table": "mcat........1",
"payer": "teresacode",
"count": 2844
}
],
"more": ""
}
And there is no table with that name:
% cleos get table teresacode default "mcat........1"
Error 3060003: Contract Table Query Exception
Most likely, the given table doesn't exist in the blockchain.
Error Details:
Unsupported table name: mcat........1
And real table is accessible fine:
% cleos get table teresacode default "mcatmig"
{
"rows": [],
"more": false,
"next_key": ""
}
I believe this happened after copying a large number of rows from table mcat
to table mcatmig
.
Something like that:
[[eosio::action]] void mcat::move(int count) {
mcat_t mcat{get_self(), name{"default"}};
mcatmig_t mcatmig{get_self(), name{"default"}};
auto it = mcat.begin();
int i = 0;
while(i < count && it != mcat.end()) {
mcatmig.emplace(...);
i++;
mcat.erase(it);
it = mcat.begin();
}
}
Why scope request return weird table name?
Is this a data corruption, move
algorithm has a bug? Or it is an eosio bug? What do you think?
Thank you!