@ -74,19 +74,19 @@ public abstract class AbstractGetHeadersFromPeerTask
final List < BlockHeader > headers = headersMessage . getHeaders ( protocolSchedule ) ;
if ( headers . isEmpty ( ) ) {
// Message contains no data - nothing to do
LOG . debug ( "headers.isEmpty. Peer: {}" , peer . getShortNod eId ( ) ) ;
LOG . debug ( "headers.isEmpty. Peer: {}" , peer . getLoggabl eId ( ) ) ;
return Optional . empty ( ) ;
}
if ( headers . size ( ) > count ) {
// Too many headers - this isn't our response
LOG . debug ( "headers.size()>count. Peer: {}" , peer . getShortNod eId ( ) ) ;
LOG . debug ( "headers.size()>count. Peer: {}" , peer . getLoggabl eId ( ) ) ;
return Optional . empty ( ) ;
}
final BlockHeader firstHeader = headers . get ( 0 ) ;
if ( ! matchesFirstHeader ( firstHeader ) ) {
// This isn't our message - nothing to do
LOG . debug ( "!matchesFirstHeader. Peer: {}" , peer . getShortNod eId ( ) ) ;
LOG . debug ( "!matchesFirstHeader. Peer: {}" , peer . getLoggabl eId ( ) ) ;
return Optional . empty ( ) ;
}
@ -100,7 +100,7 @@ public abstract class AbstractGetHeadersFromPeerTask
header = headers . get ( i ) ;
if ( header . getNumber ( ) ! = prevBlockHeader . getNumber ( ) + expectedDelta ) {
// Skip doesn't match, this isn't our data
LOG . debug ( "header not matching the expected number. Peer: {}" , peer . getShortNod eId ( ) ) ;
LOG . debug ( "header not matching the expected number. Peer: {}" , peer . getLoggabl eId ( ) ) ;
return Optional . empty ( ) ;
}
// if headers are supposed to be sequential check if a chain is formed
@ -110,7 +110,7 @@ public abstract class AbstractGetHeadersFromPeerTask
if ( ! parent . getHash ( ) . equals ( child . getParentHash ( ) ) ) {
LOG . debug (
"Sequential headers must form a chain through hashes (BREACH_OF_PROTOCOL), disconnecting peer: {}" ,
peer . getShortNod eId ( ) ) ;
peer . getLoggabl eId ( ) ) ;
peer . disconnect ( DisconnectMessage . DisconnectReason . BREACH_OF_PROTOCOL ) ;
return Optional . empty ( ) ;
}
@ -129,7 +129,7 @@ public abstract class AbstractGetHeadersFromPeerTask
. setMessage ( "Received {} of {} headers requested from peer {}..." )
. addArgument ( headersList : : size )
. addArgument ( count )
. addArgument ( peer : : getShortNod eId )
. addArgument ( peer : : getLoggabl eId )
. log ( ) ;
return Optional . of ( headersList ) ;
}
@ -138,7 +138,7 @@ public abstract class AbstractGetHeadersFromPeerTask
if ( blockHeader . getNumber ( ) > peer . chainState ( ) . getEstimatedHeight ( ) ) {
LOG . atTrace ( )
. setMessage ( "Updating chain state for peer {}... to block header {}" )
. addArgument ( peer : : getShortNod eId )
. addArgument ( peer : : getLoggabl eId )
. addArgument ( blockHeader : : toLogString )
. log ( ) ;
peer . chainState ( ) . update ( blockHeader ) ;