BCSkill (Block chain skill ) 技术社区
社区QQ群:791420381
社区论坛:http://wiki.bcskill.com
Telegram: https://t.me/bcskill

unable to find plugin: eosio::wallet_api_plugin

wallet_api_plugin is no longer supported as part of nodeos. Use keosd instead.
https://developers.eos.io/keosd/docs

参考

https://github.com/EOSIO/eos/issues/7833

eos 1.8 启动 mongo_db_plugin 插件 ENABLE_MONGO

./eosio_build.sh -m // 添加参数支持mongo

支持的参数

function usage() {
   printf "Usage: $0 OPTION...
  -P          Build with pinned clang and libcxx
  -o TYPE     Build <Debug|Release|RelWithDebInfo|MinSizeRel> (default: Release)
  -s NAME     Core Symbol Name <1-7 characters> (default: SYS)
  -b DIR      Use pre-built boost in DIR
  -i DIR      Directory to use for installing dependencies & EOSIO (default: $HOME)
  -y          Noninteractive mode (answers yes to every prompt)
  -c          Enable Code Coverage
  -d          Generate Doxygen
  -m          Build MongoDB dependencies
   \\n" "$0" 1>&2
   exit 1
}

https://github.com/EOSIO/eos/blob/51f6a070200c69eb4d82e21aa2f750d43e8491d1/scripts/eosio_build.sh#L35

EOS 合约中使用eosio::checksum256作为查询索引,查询不到问题

演示合约代码

合约中Table表结构

struct [[eosio::table, eosio::contract("bcskillsurou")]] extract_token {
    uint64_t id;
    eosio::checksum256 transaction_id;                   // 交易单id

    auto primary_key() const { return id; }
    eosio::checksum256 second_key() const { return transaction_id; } // 已hash作为二级索引

    EOSLIB_SERIALIZE(extract_token, (id)(transaction_id))
};
typedef eosio::multi_index<"xxxxtb"_n, extract_token, eosio::indexed_by<"bysubkey"_n, eosio::const_mem_fun<extract_token, eosio::checksum256, &extract_token::second_key>>> xxxx_table;

合约中查询代码

ACTION findtrxid(eosio::checksum256 trx_id){
    ....
    xxx_table xxxtb(_self, _self.value);
    auto sub_extract_index = xxxtb.get_index<"bysubkey"_n>();
    auto itr_xxx = sub_xxx_index.find(trx_id);

    eosio_assert(itr_extract != sub_xxx_index.end(), "Record not found");
    ....
}

使用Cleos 复现问题

cleos push action 合约账户 findtrxid '{"trx_id":0bb0e5901c3b627484c6a1a473ba8e3e3a3ffb4b96f849e08afb2d1e2671b88d}' -p 合约账户

返回

Error 3050003: eosio_assert_message assertion failure
Error Details:
assertion failure with message: {"code":102,"msg":"Record not found 563"}

经过测试发现是因为eosio::checksum256 trx_id传参最终打包不是已字符串打包导致,交易id上传后被识别成了

1116029241376226714100000000000000000000000000000000000000000000

解决方案

修改eosio::checksum256 trx_id为字符串即可

cleos push action 合约账户 findtrxid '{"trx_id":"0bb0e5901c3b627484c6a1a473ba8e3e3a3ffb4b96f849e08afb2d1e2671b88d"}' -p 合约账户

对于其他语言封装,处理eosio::checksum256 trx_id统一字符串打包即可

备注

特殊hash复现

参考

https://eosio.github.io/eosio.cdt/1.6.0/group__multiindex.html

received a go away message from xxxx, reason = authentication failure

主动连接方提示:

info  2019-09-03T07:20:45.197 thread-0  net_plugin.cpp:2293           handle_message       ] received a go away message from 17.1.0.9:7860, reason = authentication failure

被连接方提示:

error 2019-09-04T09:30:24.112 thread-0  net_plugin.cpp:2715           authenticate_peer    ] Peer web0_92:6886 - 5a05387 sent a handshake with a timestamp skewed by more than 1 second.
error 2019-09-04T09:30:24.112 thread-0  net_plugin.cpp:2251           handle_message       ] Peer not authenticated.  Closing connection.

由于BP节点config设置了对等网络验证

allowed-connection = producers
allowed-connection = specified

此时被链接方已经添加了主动连接方的peer-key

peer-key = "FSC71Uiuk23RACZ2PKDZQUeAgyA4w8g9DYurjtBktNes382zn1tMP"

跟下代码
https://github.com/EOSIO/eos/blob/be804bf63c5092a123c3e1a468559a8164bcd3be/plugins/net_plugin/net_plugin.cpp#L2788

namespace sc = std::chrono;
      sc::system_clock::duration msg_time(msg.time);
      auto time = sc::system_clock::now().time_since_epoch();
      if(time - msg_time > peer_authentication_interval) {
         fc_elog( logger, "Peer ${peer} sent a handshake with a timestamp skewed by more than ${time}.",
                  ("peer", msg.p2p_address)("time", "1 second")); // TODO Add to_variant for std::chrono::system_clock::duration
         return false;
      }

Peer clock may be no more than 1 second skewed from our clock, including network latency.
对等时钟与我们的时钟相差不超过1秒,包括网络延迟。

主动连接方发起连接时(当前机器本地时间)到被连接方处理时(被连方本地时间)不能超过1秒(peer_authentication_interval
如果超时就直接拒绝

解决方案

各节点开启定时同步时间服务

sudo apt-get install chrony

参考:https://blog.csdn.net/kinglyjn/article/details/53606791

eos build tag --dirty

git describe --tags --dirty
git update-index --refresh
git describe --tags --dirty

参考

https://stackoverflow.com/questions/16035240/why-is-git-describe-dirty-adding-a-dirty-suffix-when-describing-a-clean-ch