EOSIO/eosio.contracts

EOS Contract Data Persistence

lynAzrael opened this issue · 0 comments

when I send a transfer action it was failed because the amount is invalid. So I add the address into the the blacklist.

root@JD:~/eos_contract/contract/eosio.token# cleos push action test1234 transfer '["test1234", "test1235", "12346.0000 TEST","transfer"]' -p test1234
Error 3050003: eosio_assert_message assertion failure
Error Details:
assertion failure with message: to account is in blacklist
pending console output: Begin to add test1235 into balcklist.
self is test1234 symbol is TEST
After add the addr into table:
test1235
test1245

The data has been added into the table, but I can't find that address when check with cleos after that action.

root@JD:~/eos_contract/contract/eosio.token# cleos get table test1234 TEST blacklist
{
  "rows": [{
      "account": "test1245"
    }
  ],
  "more": false
}

A part of my contract =>

void token::transfer( const name&    from,
                      const name&    to,
                      const asset&   quantity,
                      const string&  memo )
{
    ....
    if (quantity.amount >= 123450000 ) {
        add_blacklist(to, syminfo);
        check( !in_blacklist(to, syminfo), "to account is in blacklist" );
    }
    ....
}

void token::add_blacklist( const name& addr, const symbol& sym )
{
    blacklists blacklist( get_self(), sym.code().raw() );
    auto iter = blacklist.find( addr.value );
    if( iter == blacklist.end() ) {
        iter = blacklist.emplace( get_self(), [&]( auto &b ) {
            b.account = addr;
        });
    }
}