智能合约 EOS 合约中执行 transfer 操作添加表数据失败

lilin1234 · December 27, 2019 · 135 hits
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;
        });
    }
}

当我发送一个超过指定额度的transfer时,显示地址被禁掉了。但是我在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

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

求大佬帮忙看下。。如果没有插入成功为什么会被禁掉?如果插入成功了,为什么查询不到呢?

No Reply at the moment.
需要 Sign In 后方可回复, 如果你还没有账号请点击这里 Sign Up