@@ -555,15 +555,14 @@ static void handleInventory2(byte[] data, RemoteEndpoint endpoint)
555555 ulong len = reader . ReadIxiVarUInt ( ) ;
556556 byte [ ] item_bytes = reader . ReadBytes ( ( int ) len ) ;
557557 InventoryItem item = InventoryCache . decodeInventoryItem ( item_bytes ) ;
558- if ( item . type == InventoryItemTypes . transaction )
559- {
560- PendingTransactions . increaseReceivedCount ( item . hash , endpoint . presence . wallet ) ;
561- }
562- PendingInventoryItem pii = InventoryCache . Instance . add ( item , endpoint ) ;
563558
564- // First update endpoint blockheights
559+ // First update endpoint blockheights and pending transactions
565560 switch ( item . type )
566561 {
562+ case InventoryItemTypes . transaction :
563+ PendingTransactions . increaseReceivedCount ( item . hash , endpoint . presence . wallet ) ;
564+ break ;
565+
567566 case InventoryItemTypes . block :
568567 var iib = ( ( InventoryItemBlock ) item ) ;
569568 if ( iib . blockNum > endpoint . blockHeight )
@@ -573,6 +572,8 @@ static void handleInventory2(byte[] data, RemoteEndpoint endpoint)
573572 break ;
574573 }
575574
575+ PendingInventoryItem pii = InventoryCache . Instance . add ( item , endpoint , false ) ;
576+
576577 if ( ! pii . processed && pii . lastRequested == 0 )
577578 {
578579 // first time we're seeing this inventory item
@@ -630,9 +631,8 @@ static void handleInventory2(byte[] data, RemoteEndpoint endpoint)
630631 static void requestNextBlock ( ulong blockNum , byte [ ] blockHash , RemoteEndpoint endpoint )
631632 {
632633 InventoryItemBlock iib = new InventoryItemBlock ( blockHash , blockNum ) ;
633- PendingInventoryItem pii = InventoryCache . Instance . add ( iib , endpoint ) ;
634- if ( ! pii . processed
635- && pii . lastRequested == 0 )
634+ PendingInventoryItem pii = InventoryCache . Instance . add ( iib , endpoint , true ) ;
635+ if ( pii . lastRequested == 0 )
636636 {
637637 pii . lastRequested = Clock . getTimestamp ( ) ;
638638 InventoryCache . Instance . processInventoryItem ( pii ) ;
0 commit comments