Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #7048 from EOSIO/1.6.4-security-omnibus
Browse files Browse the repository at this point in the history
Consolidated Security Fixes for 1.6.4
  • Loading branch information
heifner authored Apr 2, 2019
2 parents 82a2c0f + bf33876 commit eeec125
Showing 1 changed file with 7 additions and 38 deletions.
45 changes: 7 additions & 38 deletions plugins/net_plugin/net_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,6 @@ namespace eosio {

const string peer_name();

void txn_send_pending(const vector<transaction_id_type>& ids);
void txn_send(const vector<transaction_id_type>& txn_lis);

void blk_send_branch();
void blk_send(const block_id_type& blkid);
void stop_send();
Expand Down Expand Up @@ -833,26 +830,6 @@ namespace eosio {
if( read_delay_timer ) read_delay_timer->cancel();
}

void connection::txn_send_pending(const vector<transaction_id_type>& ids) {
const std::set<transaction_id_type, sha256_less> known_ids(ids.cbegin(), ids.cend());
my_impl->expire_local_txns();
for(auto tx = my_impl->local_txns.begin(); tx != my_impl->local_txns.end(); ++tx ){
const bool found = known_ids.find( tx->id ) != known_ids.cend();
if( !found ) {
queue_write( tx->serialized_txn, true, []( boost::system::error_code ec, std::size_t ) {} );
}
}
}

void connection::txn_send(const vector<transaction_id_type>& ids) {
for(const auto& t : ids) {
auto tx = my_impl->local_txns.get<by_id>().find(t);
if( tx != my_impl->local_txns.end() ) {
queue_write( tx->serialized_txn, true, []( boost::system::error_code ec, std::size_t ) {} );
}
}
}

void connection::blk_send_branch() {
controller& cc = my_impl->chain_plug->chain();
uint32_t head_num = cc.fork_db_head_block_num();
Expand Down Expand Up @@ -2375,17 +2352,6 @@ namespace eosio {
break;
}
case catch_up : {
if( msg.known_trx.pending > 0) {
// plan to get all except what we already know about.
req.req_trx.mode = catch_up;
send_req = true;
size_t known_sum = local_txns.size();
if( known_sum ) {
for( const auto& t : local_txns.get<by_id>() ) {
req.req_trx.ids.push_back( t.id );
}
}
}
break;
}
case normal: {
Expand Down Expand Up @@ -2443,14 +2409,17 @@ namespace eosio {

switch (msg.req_trx.mode) {
case catch_up :
c->txn_send_pending(msg.req_trx.ids);
break;
case normal :
c->txn_send(msg.req_trx.ids);
break;
case none :
if(msg.req_blocks.mode == none)
c->stop_send();
// no break
case normal :
if( !msg.req_trx.ids.empty() ) {
elog( "Invalid request_message, req_trx.ids.size ${s}", ("s", msg.req_trx.ids.size()) );
close(c);
return;
}
break;
default:;
}
Expand Down

0 comments on commit eeec125

Please sign in to comment.