@@ -764,8 +764,8 @@ private void processAdvBlock(PeerConnection peer, BlockCapsule block) {
764764 //TODO: lack the complete flow.
765765 if (!freshBlockId .contains (block .getBlockId ())) {
766766 try {
767- LinkedList <Sha256Hash > trxIds = del . handleBlock ( block , false ) ;
768-
767+ LinkedList <Sha256Hash > trxIds = null ;
768+ trxIds = del . handleBlock ( block , false );
769769 freshBlockId .offer (block .getBlockId ());
770770
771771 trxIds .forEach (trxId -> advObjToFetch .remove (trxId ));
@@ -786,18 +786,25 @@ private void processAdvBlock(PeerConnection peer, BlockCapsule block) {
786786 block .getBlockId ().getString (), peer .getNode ().getHost (),
787787 del .getHeadBlockId ().getString ());
788788 startSyncWithPeer (peer );
789- } catch (Exception e ) {
790- logger .error ("Fail to process adv block {} from {}" , block .getBlockId ().getString (),
791- peer .getNode ().getHost (), e );
789+ } catch (InterruptedException e ) {
790+ Thread .currentThread ().interrupt ();
792791 }
792+
793+ // logger.error("Fail to process adv block {} from {}", block.getBlockId().getString(),
794+ // peer.getNode().getHost(), e);
795+
793796 }
794797 }
795798
796799 private boolean processSyncBlock (BlockCapsule block ) {
797800 boolean isAccept = false ;
798801 ReasonCode reason = null ;
799802 try {
800- del .handleBlock (block , true );
803+ try {
804+ del .handleBlock (block , true );
805+ } catch (InterruptedException e ) {
806+ Thread .currentThread ().interrupt ();
807+ }
801808 freshBlockId .offer (block .getBlockId ());
802809 logger .info ("Success handle block {}" , block .getBlockId ().getString ());
803810 isAccept = true ;
0 commit comments