提交 3e733f57 编写于 作者: K Kevin Heifner

Fix overflow of deadline and deadline check

上级 9270c9cb
......@@ -88,14 +88,12 @@ flat_set<public_key_type> transaction::get_signature_keys( const vector<signatur
constexpr size_t recovery_cache_size = 1000;
static thread_local recovery_cache_type recovery_cache;
fc::time_point start = fc::time_point::now();
const digest_type digest = sig_digest(chain_id, cfd);
flat_set<public_key_type> recovered_pub_keys;
for(const signature_type& sig : signatures) {
auto now = fc::time_point::now();
EOS_ASSERT( start + now <= deadline, tx_cpu_usage_exceeded, "transaction signature verification executed for too long",
("now", now)("deadline", deadline)("start", start) );
EOS_ASSERT( fc::time_point::now() < deadline, tx_cpu_usage_exceeded, "transaction signature verification executed for too long",
("now", fc::time_point::now())("deadline", deadline) );
public_key_type recov;
recovery_cache_type::index<by_sig>::type::iterator it = recovery_cache.get<by_sig>().find( sig );
const auto& tid = id();
......
......@@ -26,7 +26,8 @@ void transaction_metadata::create_signing_keys_future( const transaction_metadat
std::weak_ptr<transaction_metadata> mtrx_wp = mtrx;
mtrx->signing_keys_future = async_thread_pool( thread_pool, [timelimit, chain_id, mtrx_wp]() {
fc::time_point deadline = fc::time_point::now() + timelimit;
fc::time_point deadline = timelimit == fc::microseconds::maximum() ?
fc::time_point::maximum() : fc::time_point::now() + timelimit;
auto mtrx = mtrx_wp.lock();
return mtrx ?
std::make_pair( chain_id, mtrx->trx.get_signature_keys( chain_id, deadline ) ) :
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册