|
|
@ -425,21 +425,17 @@ bool EthereumPeer::interpret(unsigned _id, RLP const& _r) |
|
|
|
unsigned future = 0; |
|
|
|
unsigned unknown = 0; |
|
|
|
unsigned got = 0; |
|
|
|
unsigned repeated = 0; |
|
|
|
|
|
|
|
for (unsigned i = 1; i < _r.itemCount(); ++i) |
|
|
|
{ |
|
|
|
auto h = BlockInfo::headerHash(_r[i].data()); |
|
|
|
m_sub.noteBlock(h); |
|
|
|
|
|
|
|
if (m_sub.noteBlock(h)) |
|
|
|
{ |
|
|
|
Guard l(x_knownBlocks); |
|
|
|
m_knownBlocks.insert(h); |
|
|
|
} |
|
|
|
|
|
|
|
addRating(10); |
|
|
|
switch (host()->m_bq.import(_r[i].data(), host()->m_chain)) |
|
|
|
{ |
|
|
|
case ImportResult::Success: |
|
|
|
addRating(1); |
|
|
|
success++; |
|
|
|
break; |
|
|
|
|
|
|
@ -461,8 +457,14 @@ bool EthereumPeer::interpret(unsigned _id, RLP const& _r) |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
addRating(0); // -1?
|
|
|
|
repeated++; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
clogS(NetMessageSummary) << dec << success << "imported OK," << unknown << "with unknown parents," << future << "with future timestamps," << got << " already known."; |
|
|
|
clogS(NetMessageSummary) << dec << success << "imported OK," << unknown << "with unknown parents," << future << "with future timestamps," << got << " already known," << repeated << " repeats received."; |
|
|
|
|
|
|
|
if (m_asking == Asking::Blocks) |
|
|
|
transition(Asking::Blocks); |
|
|
@ -480,8 +482,10 @@ bool EthereumPeer::interpret(unsigned _id, RLP const& _r) |
|
|
|
switch (host()->m_bq.import(_r[1].data(), host()->m_chain)) |
|
|
|
{ |
|
|
|
case ImportResult::Success: |
|
|
|
addRating(100); |
|
|
|
break; |
|
|
|
case ImportResult::FutureTime: |
|
|
|
addRating(1); |
|
|
|
//TODO: Rating dependent on how far in future it is.
|
|
|
|
break; |
|
|
|
|
|
|
|
case ImportResult::Malformed: |
|
|
|