code: protected void parseTransactions(final int transactionsOffset) throws ProtocolException {
          cursor = transactionsOffset;
          optimalEncodingMessageSize = HEADER_SIZE;
          if (payload.length == cursor) {
              // This message is just a header, it has no transactions.
              transactionBytesValid = false;
              return;
          }
  
          int numTransactions = (int) readVarInt();
          optimalEncodingMessageSize += VarInt.sizeOf(numTransactions);
          transactions = new ArrayList<>(Math.min(numTransactions, Utils.MAX_INITIAL_ARRAY_LENGTH));
          for (int i = 0; i < numTransactions; i++) {
              Transaction tx = new Transaction(params, payload, cursor, this, serializer, UNKNOWN_LENGTH, null);
              // Label the transaction as coming from the P2P network, so code that cares where we first saw it knows.
              tx.getConfidence().setSource(TransactionConfidence.Source.NETWORK);
              transactions.add(tx);
              cursor += tx.getMessageSize();
              optimalEncodingMessageSize += tx.getOptimalEncodingMessageSize();
          }
          transactionBytesValid = serializer.isParseRetainMode();
      }
docs: Parse transactions from the block.
  
  @param transactionsOffset Offset of the transactions within the block.
  Useful for non-Bitcoin chains where the block header may not be a fixed
  size.